From 04954c05006d6adcefb6db5a51f88cec036ac14e Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 27 Nov 2026 18:02:26 +0100 Subject: [PATCH 01/13] Live collaboration target: invariants, probes, identity table Target document for the brokkr-live campaign: the agent works in the same live Blender scene the operator is looking at. Records the Blender 5.3 timer-undo and viewport-capture probes the invariants stand on, and the identity, lifecycle and authority table for every kind the layer adds. Co-Authored-By: Claude Opus 5.5 --- docs/live-collab-target.md | 203 ++++++++++++++++++ docs/research/live-collab/probe_look.py | 68 ++++++ docs/research/live-collab/probe_timer_undo.py | 146 +++++++++++++ 3 files changed, 417 insertions(+) create mode 100644 docs/live-collab-target.md create mode 100644 docs/research/live-collab/probe_look.py create mode 100644 docs/research/live-collab/probe_timer_undo.py diff --git a/docs/live-collab-target.md b/docs/live-collab-target.md new file mode 100644 index 0000000..acbdb07 --- /dev/null +++ b/docs/live-collab-target.md @@ -0,0 +1,203 @@ +# Brokkr live collaboration: target + +Campaign `brokkr-live` (Nibu's mind). Working branch `nibu/live-collab-target`, base +`origin/main` 5e279b2. This document holds the rationale, the design truths the +campaign produces, and the identity, lifecycle and authority table. The typed +`target` in the mind holds the labelled invariants and the not-in-scope list; the +text below is their source. + +## Why + +Operator, 2026-11-27: Brokkr "is meant to give an agent hands into the same Blender +scene I'm looking at, enabling live collaboration work". Brokkr already runs inside +her live Blender: a `depsgraph_update_post` handler publishes a host snapshot and a +persistent 1 s `bpy.app.timers` callback drains command intents +(`surfaces/blender/brokkr_bridge/__init__.py:610-647`, `:668-671`). What it lacks is +everything that makes two people in one scene a collaboration rather than a remote +control: + +- an agent edit is not an undo step (research `nibu-body:research:blender-live-collab.brokkr-undo`); +- nobody can tell who made an edit: the Blender side reads no `requestedBy` + (`.brokkr-attribution-gate`); +- the human cannot stop an agent except by unticking a preference, and a queued intent + still runs if she ticks it back; +- the agent sees names and counts, not the viewport and not the Edit Mode selection + (`.brokkr-perception`); +- nothing stops an agent intent planned against an old scene from overwriting what she + did since; +- the agent has no hands: `brokkr-ctl` has no source (`.brokkr-no-agent-surface`). + +Its strengths stay: typed, validated actions with no free-form Python, path +confinement, loopback bind and an optional session token (`.brokkr-security`). + +## Prior art the design stands on + +- **mcp-for-blender's `UserEditRecorder`** (`.mcp4b-human-edits`): buffers human + operator and undo/redo events with `undo_post`/`redo_post` handlers, attributes events + during an agent command to the agent, and hands the agent the human's activity before + its next action. We take the idea (the agent learns what the human did) and drop the + trajectory log: the snapshot carries per-object human-edit sequence numbers instead. +- **blender-copilot** (`.copilot-undo-cancel`): one undo step per agent turn, a Stop + button, visible turns and an undo receipt, no approval gate. Its Stop cannot interrupt + a blocking native call. We take all four and accept the same limit. +- **Multi-User** (`.humans-multiuser`) and the paid collab add-ons (`.humans-others`): + presence of the other party in the 3D view, rights and object locks. We take presence + as a panel, derived from intents and receipts; human-to-human replication is theirs, + not ours. +- **Blender Lab MCP and mcp-for-blender** (`.lab-official`, `.mcp4b-perception-safe`): + viewport screenshots as perception; arbitrary code with a weak or default-off + sandbox, and no undo. The perception we copy; the code path is fork Q1. +- **ceeyang/blender_mcp** (`.ceeyang-159`): 159 typed tools, every write undoable. The + existence proof that a typed vocabulary can be wide. +- The brush-tree campaign's `one-commit-primitive` (Libby's mind): a stale base is + refused, never merged. The conflict rule below is the same rule applied to a live scene. + +## What probing established (Blender 5.3.0, Starfire, GUI, `--factory-startup`) + +Probe scripts: `docs/research/live-collab/probe_timer_undo.py` and `probe_look.py`. +Each step runs in its own timer tick, as Brokkr's drain does. + +1. **A write from a timer with no undo push is not a step, and it survives undo.** The + cube moved to x=1 with no push; one `ed.undo` left it at x=1. The next push captured + it, so the agent's write became part of the next step, whoever made it (case A). The + vendor warning (`.undo-timer-warning`) is real for unpushed writes, and the failure is + worse than "not undoable": the edit is misattributed. +2. **An explicit `ed.undo_push` from a timer makes a correct step.** x=2 pushed, x=3 + pushed; undo gave 2, undo gave 1 (the earlier step), redo gave 2 (case B). +3. **An UNDO-flagged operator called from a timer pushes its own step.** A sphere added + by `primitive_uv_sphere_add` vanished on one undo with no explicit push (case C). An + action that calls two operators therefore makes two steps unless told otherwise. +4. **Operators called with `undo=False` push nothing; one explicit push then covers + them.** Cube and cone added with `("EXEC_DEFAULT", False)`, one push, one undo removed + both, a second undo changed nothing (case E). This is the mechanism for "one intent, + one step". +5. **Edit Mode:** a bmesh write plus push in Edit Mode is reverted by one undo, and that + undo also left Edit Mode (the agent had entered it in the same probe); the mesh kept + its original vertex (case D). Mode entry and the agent step are not cleanly separable + when the agent itself changed mode. Not yet probed: the human in Edit Mode and the + agent writing. +6. **Driving `ed.undo`/`ed.redo` programmatically from timers crashed Blender 2 of 2 + times** in the long sequence (A through E in one session), with + `EXCEPTION_ACCESS_VIOLATION` in UI draw code after a memfile undo + (`outliner_draw_restrictbuts`, then `psys_get_current` from the properties editor). The + short sequences (C alone, D alone, E alone) did not crash. Cause not isolated; the + probe's own `temp_override` with a captured region is a suspect. +7. **The agent can see what the human sees.** `bpy.ops.screen.screenshot_area` on the + 3D view from a timer: 7 of 7 `FINISHED`, median 72.5 ms over runs 2-7 at 1574x888, + about 609 KB PNG, and it captured the splash screen over the viewport, so it is the + human's view, overlays and popups included. Each capture stalls her UI for that long. +8. **Edit Mode selection reads live** through `bmesh.from_edit_mesh` without leaving Edit + Mode: selected vertices `[0, 3]`, 0.013 ms, mode still `EDIT_MESH`. + +Not yet probed, and owed before the cut that depends on it: whether depsgraph updates +caused by an agent intent arrive inside the timer callback or after it returns (this +decides how human edits are told from agent edits); and whether a human Ctrl+Z inside a +pending agent intent's base window can be detected reliably by `undo_post`. + +## Design truths + +**One agent turn primitive.** Every agent mutation in Blender goes through one function +in the add-on: admit (sink enabled, `requestedBy` present, id unused, base fresh), run +the action with every operator called `undo=False`, push exactly one undo step labelled +`Brokkr : `, write the receipt. A refusal or a +failure pushes nothing and leaves the scene as it was. Typed actions, the node actions, +and `run` if Q1 keeps it, all use it; there is no second writer. + +**Undo belongs to the human.** Blender's one linear stack is the shared history. The +agent's steps sit in it, labelled, between hers; she undoes them with Ctrl+Z like her +own. The agent never calls `ed.undo` or `ed.redo` (probe 6); an agent that wants to back +out sends a new compensating intent, which is one more step. Undoing an agent step that +sits under later human steps is not offered: Blender's stack is linear and per-user undo +is out of scope. + +**Stop is one control, and only the human holds it.** The Brokkr panel's Stop turns the +command sink off and gives every pending intent a `stopped` receipt without running it. +An action already running finishes (a blocking native call cannot be interrupted, as in +blender-copilot); it is one undo step, so Stop plus Ctrl+Z always returns her scene. No +intent can turn the sink on. Re-enabling is a fresh decision, and intents queued before +Stop never run. + +**The agent sees her view and her edits.** `look` is a read intent: it captures her 3D +view to a scratch PNG named by command id (ruling `brush-tree:ruling:look-files-are-scratch`) +and returns the path; it pushes no undo step. The snapshot gains the Edit Mode selection +and a Blender session id plus human-edit sequence numbers: one counter for the session, +the last sequence at which the human touched each object, and the last sequence at which +she undid or redid. The agent reads "what changed since I last looked" from those. + +**A human edit is never silently overwritten.** Every mutating intent names the base +sequence it was planned against. If the human touched any datablock the intent targets +since that base, or undid or redid since it, or the session id changed, the intent is +refused with a `conflict` receipt naming what changed, and nothing is applied. The +agent looks again and re-plans. Granularity is fork Q3. + +**Presence is derived.** The panel shows which agents have intents or receipts in the +last minutes, the running or last intent with its one-line `note`, and the recent +receipts with their undo labels. It reads the intent and receipt documents; it owns no +state of its own. + +**Hands are a CLI.** `brokkr-ctl blender` (Rust, ruling `brush-tree:ruling:fitting-home-ruled`) +writes intents and reads receipts and snapshots through the Blender mirror store +(`brush-tree:ruling:blender-transport-ruled`), prints plain text or paths, and its +`--help` is the schema (`brush-tree:ruling:cli-not-mcp`, `:help-is-the-schema`). It owns +no state, policy or ledger (brush-tree target invariant `brokkr-authority-holds`). + +## Authority map + +- **Owner.** The add-on's agent turn primitive owns whether and how an agent intent + changes the live scene. Blender owns scene truth and the undo stack. The human owns + the sink toggle, Stop, and undo. +- **Inputs.** Intent documents; the snapshot's human-edit sequences; the sink toggle. +- **Outputs.** One undo step per accepted mutating intent; one receipt per intent; + the refreshed snapshot; look PNG paths. +- **Derived state.** Presence (from intents and receipts). Human-edit sequences + (from depsgraph and undo handlers, observations only). Look PNGs (telemetry). +- **Forbidden writers.** `execute_command` called outside the primitive; operators + called with undo on inside an agent action; any raw RNA write by an agent without the + closing push; `ed.undo`/`ed.redo` from add-on code; the debug-mirror JSON import + (`blender_target.py` `_import_debug_command_files`) as a second door for intents; + `brokkr-ctl` opening the store to decide anything. +- **Shared paths.** brokkr-ctl intents, panel buttons that act on the scene, sync-organ + intents from `brokkr-daemon sync-once`, and replayed intents use the one primitive. +- **Deletion line.** The debug-mirror intent import goes before the primitive lands; + `drain_commands` stops calling `execute_command` directly. + +## Identity, lifecycle and authority + +| Persistent kind | What names it | What happens to it over time | Who decides | +|---|---|---|---| +| Blender command intent `brokkr.blender.command_intent.v0` (gains `requestedBy`, `baseSeq`, `note`) | `blender/commands/{commandId}`; ids single-use, minted by the writer (Unity F6 A, `brush-tree:ruling:blender-sink-mirrors-unity`) | Written once by a caller. Executed at most once or refused. Removed when its receipt is written, as today. Never rewritten. | Callers write. The agent turn primitive alone decides admission and execution. | +| Blender command receipt `brokkr.blender.command_receipt.v0` (gains `requestedBy`, `outcome` in accepted, denied, conflict, stopped, failed, `undoLabel`, `lookPath`, and for `run` the script text and SHA-256) | `blender/receipts/{commandId}`, one per intent | Written once, after the primitive decides. Pruned by count with Unity's cap and prune rule. The only proof an intent ran. | The primitive alone. Callers and the panel read. | +| Agent identity `requestedBy` | `/` stated by the caller (brokkr-ctl takes it from `EUREKA_INSTANCE` and a flag) | Carried on each intent into its receipt and undo label; not stored on its own. | The caller states it; the primitive refuses an intent without it. The session token proves admission, not identity. | +| Agent undo step | Blender undo stack entry labelled `Brokkr : ` | Pushed once per accepted mutating intent; lives as Blender's stack does (step limit, file load); never persisted by Brokkr. | Blender owns the stack. The primitive pushes. Only the human undoes or redoes. | +| Blender session id | uuid minted at add-on register and on each `load_post` | Replaced when Blender restarts or a file loads; every older base is then stale. | The add-on alone. | +| Human-edit sequences (snapshot fields: `humanEditSeq`, per-object `lastHumanEditSeq`, `lastUndoSeq`) | Integers within a session id | Monotonic within a session; reset with it. Observations, never scene truth. | The add-on's depsgraph and undo handlers alone. | +| Host snapshot `brokkr.blender.host_snapshot.v0` (gains Edit Mode selection, session id, the sequences above, sink state) | `blender/host/current`, overwritten | Refreshed on depsgraph update and after each intent. | The add-on alone. | +| Command sink toggle (the existing `auto_drain_commands` preference) | Add-on preference, echoed in the snapshot | Off by default. Stop turns it off; only the human turns it on. | The human only. No intent writes it. | +| Script toggle (only if Q1 = b) | A second add-on preference, echoed in the snapshot | Off by default, independent of the sink. | The human only. | +| Look PNG | `/look/{commandId}.png` | Pruned by count; never read back as truth. | The primitive writes; `brush-tree:ruling:look-files-are-scratch` governs. | + +## Not in scope + +Human-to-human replication or several Blender instances in one session (Multi-User's +domain). Agents on another host reaching the operator's Blender: the transport is not +widened beyond what the add-on serves today. Per-user or selective undo. An approval gate +before each agent action (unless Q2 rules otherwise). A 3D-view overlay of the agent's +presence; the panel carries presence in this revision. The Unity surface and +`brokkr-command`. The brush-tree vocabulary, Geometry.Csg and OpenSCAD text (brush-tree +owns them). Agent-initiated save and quit (`brush-tree:ruling:run-admitted-when-enabled` +keeps them off the allowed list). Asset libraries and generators. An MCP server. + +## Open forks (draft questions; Self admits) + +- **Q1. Free-form Python.** Today the Blender add-on has no script action. Libby's + Defaulted ruling `brush-tree:ruling:run-admitted-when-enabled` would add `run`, admitted + whenever agent commands are on. Options: (a) typed actions only; (b) `run` behind its + own off-by-default toggle, one undo step, script text in the receipt; (c) the Defaulted + ruling as written. Recommend (b). +- **Q2. Act then undo, or approve first.** Recommend act then undo, with Stop. +- **Q3. Conflict granularity.** (a) any human edit since the base refuses; (b) only edits to + the intent's targets, plus any undo or redo. Recommend (b), after the depsgraph + attribution probe. +- **Q4. Who builds `brokkr-ctl blender`.** Recommend this campaign builds the session + subcommands in Rust per Libby's rulings, and brush-tree adds its tree commands to the + same binary later. diff --git a/docs/research/live-collab/probe_look.py b/docs/research/live-collab/probe_look.py new file mode 100644 index 0000000..1e8851c --- /dev/null +++ b/docs/research/live-collab/probe_look.py @@ -0,0 +1,68 @@ +"""Probe: can a timer callback capture the 3D viewport the human sees, and read Edit Mode selection? + +blender --factory-startup --python probe_look.py -- +""" +import json +import os +import statistics +import sys +import time +import traceback + +import bmesh +import bpy + +args = sys.argv[sys.argv.index("--") + 1:] +OUT, PNG_DIR = args[0], args[1] +log = {"blender": bpy.app.version_string} + + +def ctx(): + win = bpy.context.window_manager.windows[0] + area = next(a for a in win.screen.areas if a.type == "VIEW_3D") + region = next(r for r in area.regions if r.type == "WINDOW") + return win, area, region + + +def run(): + win, area, region = ctx() + log["view3d_px"] = [region.width, region.height] + times = [] + for n in range(7): + path = os.path.join(PNG_DIR, f"look-{n}.png") + t = time.perf_counter() + with bpy.context.temp_override(window=win, area=area, region=region): + r = bpy.ops.screen.screenshot_area(filepath=path) + times.append((time.perf_counter() - t) * 1000) + log.setdefault("results", []).append(list(r)) + log["screenshot_ms"] = [round(x, 1) for x in times] + log["screenshot_ms_median"] = round(statistics.median(times[1:]), 1) + log["png_bytes"] = os.path.getsize(os.path.join(PNG_DIR, "look-6.png")) + # Edit Mode selection read, live, without leaving Edit Mode. + with bpy.context.temp_override(window=win, area=area, region=region): + bpy.ops.object.mode_set(mode="EDIT") + bpy.ops.mesh.select_all(action="DESELECT") + bm = bmesh.from_edit_mesh(bpy.data.objects["Cube"].data) + bm.verts.ensure_lookup_table() + bm.verts[0].select = True + bm.verts[3].select = True + bm.select_flush_mode() + t = time.perf_counter() + sel = [v.index for v in bmesh.from_edit_mesh(bpy.data.objects["Cube"].data).verts if v.select] + log["edit_selection_read_ms"] = round((time.perf_counter() - t) * 1000, 3) + log["edit_selected_verts"] = sel + log["mode_after_read"] = bpy.context.mode + + +def tick(): + try: + run() + except Exception: + log["error"] = traceback.format_exc() + with open(OUT, "w") as f: + json.dump(log, f, indent=1) + bpy.ops.wm.quit_blender() + return None + + +bpy.app.timers.register(tick, first_interval=3.0) diff --git a/docs/research/live-collab/probe_timer_undo.py b/docs/research/live-collab/probe_timer_undo.py new file mode 100644 index 0000000..57886fb --- /dev/null +++ b/docs/research/live-collab/probe_timer_undo.py @@ -0,0 +1,146 @@ +"""Probe: do edits made from a bpy.app.timers callback land on Blender's undo stack? + +Run in GUI Blender: blender --factory-startup --python probe_timer_undo.py -- [cases, e.g. AB] +Each step is its own timer tick so the event loop runs between steps, as it does +for Brokkr's 1 s drain. Results are written to the JSON path, then Blender quits. +""" +import json +import sys +import traceback + +import bmesh +import bpy + +OUT = sys.argv[sys.argv.index("--") + 1] +log = {"blender": bpy.app.version_string, "background": bpy.app.background, "steps": []} + + +def win_ctx(): + win = bpy.context.window_manager.windows[0] + area = next(a for a in win.screen.areas if a.type == "VIEW_3D") + return bpy.context.temp_override(window=win, area=area, region=area.regions[-1]) + + +def cube(): + return bpy.data.objects.get("Cube") + + +def state(tag): + c = cube() + s = { + "tag": tag, + "cube_x": round(c.location.x, 3) if c else None, + "objects": sorted(o.name for o in bpy.data.objects), + "mode": bpy.context.mode, + "mesh_v0_z": round(c.data.vertices[0].co.z, 3) if c else None, + } + if c and c.mode == "EDIT": + bm = bmesh.from_edit_mesh(c.data) + bm.verts.ensure_lookup_table() + s["edit_v0_z"] = round(bm.verts[0].co.z if bm.verts else 0, 3) + log["steps"].append(s) + return s + + +def push(msg): + with win_ctx(): + r = bpy.ops.ed.undo_push(message=msg) + log["steps"].append({"tag": f"undo_push:{msg}", "result": list(r)}) + + +def undo(): + with win_ctx(): + r = bpy.ops.ed.undo() + log["steps"].append({"tag": "undo", "result": list(r)}) + + +def redo(): + with win_ctx(): + r = bpy.ops.ed.redo() + log["steps"].append({"tag": "redo", "result": list(r)}) + + +# Case A: raw RNA write from a timer, no push. Does Ctrl+Z see it as its own step? +# Case B: RNA write then an explicit undo_push from the timer. +# Case C: an UNDO-flagged operator called from a timer, no explicit push. +# Case D: Edit Mode bmesh write from a timer then undo_push. +# Case E: two operators called with undo=False, then one explicit undo_push. +ONLY = sys.argv[sys.argv.index("--") + 2] if len(sys.argv) > sys.argv.index("--") + 2 else "ABCDE" +steps = [ + lambda: (push("baseline"), state("A0 baseline")), + lambda: (setattr(cube().location, "x", 1.0), state("A1 raw write x=1, no push")), + lambda: (undo(), state("A2 after one undo")), + lambda: (push("rebase-B"), state("B0")), + lambda: (setattr(cube().location, "x", 2.0), push("agent: x=2"), state("B1 x=2 pushed")), + lambda: (setattr(cube().location, "x", 3.0), push("agent: x=3"), state("B2 x=3 pushed")), + lambda: (undo(), state("B3 after undo (expect x=2)")), + lambda: (undo(), state("B4 after second undo (expect x=0)")), + lambda: (redo(), state("B5 after redo (expect x=2)")), + lambda: (push("rebase-C"), state("C0")), + lambda: (_add_sphere(), state("C1 op add sphere, no push")), + lambda: (undo(), state("C2 after undo (sphere gone?)")), + lambda: (bpy.context.view_layer.objects.__setattr__("active", cube()), cube().select_set(True), push("rebase-D"), state("D0")), + lambda: (_edit_enter(), state("D1 edit mode")), + lambda: (_edit_write(), push("agent: edit v0"), state("D2 v0 moved, pushed")), + lambda: (undo(), state("D3 after undo (expect v0 back)")), + lambda: (undo(), state("D4 after second undo")), + lambda: (_edit_exit(), push("rebase-E"), state("E0")), + lambda: (_two_ops_one_step(), push("agent: two ops"), state("E1 two ops undo=False + one push")), + lambda: (undo(), state("E2 after one undo (expect both gone)")), + lambda: (undo(), state("E3 after second undo (expect no change)")), +] + + +def _add_sphere(): + with win_ctx(): + bpy.ops.mesh.primitive_uv_sphere_add(location=(5, 0, 0)) + + +def _edit_exit(): + if bpy.context.mode != "OBJECT": + with win_ctx(): + bpy.ops.object.mode_set(mode="OBJECT") + + +def _two_ops_one_step(): + with win_ctx(): + bpy.ops.mesh.primitive_cube_add("EXEC_DEFAULT", False, location=(0, 4, 0)) + bpy.ops.mesh.primitive_cone_add("EXEC_DEFAULT", False, location=(0, -4, 0)) + + +def _edit_enter(): + with win_ctx(): + bpy.ops.object.mode_set(mode="EDIT") + + +def _edit_write(): + c = cube() + bm = bmesh.from_edit_mesh(c.data) + bm.verts.ensure_lookup_table() + bm.verts[0].co.z += 5.0 + bmesh.update_edit_mesh(c.data) + + +i = 0 +_all = steps +steps = [f for f, c in zip(_all, "AAABBBBBBCCCDDDDDEEEE") if c in ONLY] + + +def tick(): + global i + if i < len(steps): + try: + steps[i]() + except Exception: + log["steps"].append({"tag": f"step {i} error", "error": traceback.format_exc()}) + i += 1 + with open(OUT, "w") as f: + json.dump(log, f, indent=1) + return 0.3 + with open(OUT, "w") as f: + json.dump(log, f, indent=1) + bpy.ops.wm.quit_blender() + return None + + +bpy.app.timers.register(tick, first_interval=2.0) -- 2.47.3 From 48c0aeee6d702c28da79fd275042d95455eb557e Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 27 Nov 2026 18:07:37 +0100 Subject: [PATCH 02/13] Live collab: depsgraph timing probe Records when depsgraph updates from an agent edit in a timer arrive and which ids they name, for the human-edit detection fork (Q3). Co-Authored-By: Claude Opus 5.5 --- .../live-collab/probe_depsgraph_timing.py | 134 ++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 docs/research/live-collab/probe_depsgraph_timing.py diff --git a/docs/research/live-collab/probe_depsgraph_timing.py b/docs/research/live-collab/probe_depsgraph_timing.py new file mode 100644 index 0000000..d763e07 --- /dev/null +++ b/docs/research/live-collab/probe_depsgraph_timing.py @@ -0,0 +1,134 @@ +"""Probe: when do depsgraph updates caused by an agent edit in a timer arrive, and what do they name? + +blender --factory-startup --python probe_depsgraph_timing.py -- + +Each case runs in its own timer tick. AGENT is True only while the timer callback +runs the edit. depsgraph_update_post and undo_post log every call with AGENT's value, +the tick that was current, and the ids depsgraph.updates names. +""" +import json +import sys +import time +import traceback + +import bpy + +OUT = sys.argv[sys.argv.index("--") + 1] +log = {"blender": bpy.app.version_string, "events": []} +AGENT = False +TICK = "setup" +T0 = time.perf_counter() + + +def ev(kind, **kw): + log["events"].append({"kind": kind, "tick": TICK, "agent": AGENT, + "ms": round((time.perf_counter() - T0) * 1000, 1), **kw}) + + +@bpy.app.handlers.persistent +def on_depsgraph(scene, depsgraph): + ups = [] + for u in depsgraph.updates: + ups.append(f"{type(u.id).__name__}:{u.id.name}" + f"{'/T' if u.is_updated_transform else ''}{'/G' if u.is_updated_geometry else ''}") + ev("depsgraph", updates=ups) + + +@bpy.app.handlers.persistent +def on_undo(scene, *_): + ev("undo_post") + + +@bpy.app.handlers.persistent +def on_redo(scene, *_): + ev("redo_post") + + +def win_ctx(): + win = bpy.context.window_manager.windows[0] + area = next(a for a in win.screen.areas if a.type == "VIEW_3D") + region = next(r for r in area.regions if r.type == "WINDOW") + return bpy.context.temp_override(window=win, area=area, region=region) + + +def setup(): + # B follows A through a Copy Location constraint: an indirect dependent of A. + a = bpy.data.objects["Cube"] + with win_ctx(): + bpy.ops.mesh.primitive_cone_add("EXEC_DEFAULT", False, location=(0, 3, 0)) + b = bpy.context.active_object + b.name = "Follower" + c = b.constraints.new("COPY_LOCATION") + c.target = a + c.use_y = False + with win_ctx(): + bpy.ops.ed.undo_push(message="setup") + + +def agent(fn, flush): + global AGENT + AGENT = True + ev("turn_begin", flush=flush) + fn() + with win_ctx(): + bpy.ops.ed.undo_push(message=f"agent {TICK}") + if flush: + bpy.context.view_layer.update() + ev("turn_end") + AGENT = False + + +def move_a(x): + return lambda: setattr(bpy.data.objects["Cube"].location, "x", x) + + +def add_op(): + with win_ctx(): + bpy.ops.mesh.primitive_uv_sphere_add("EXEC_DEFAULT", False, location=(-4, 0, 0)) + + +def undo_once(): + with win_ctx(): + bpy.ops.ed.undo() + + +cases = [ + ("setup", setup), + ("idle1", lambda: None), + ("rna-noflush", lambda: agent(move_a(1.0), False)), + ("idle2", lambda: None), + ("rna-flush", lambda: agent(move_a(2.0), True)), + ("idle3", lambda: None), + ("op-noflush", lambda: agent(add_op, False)), + ("idle4", lambda: None), + ("op-flush", lambda: agent(add_op, True)), + ("idle5", lambda: None), + ("undo", undo_once), # stands in for a human Ctrl+Z (not an agent turn) + ("idle6", lambda: None), +] +i = 0 + + +def tick(): + global i, TICK + if i < len(cases): + TICK, fn = cases[i] + try: + fn() + except Exception: + ev("error", error=traceback.format_exc()) + TICK = f"after:{TICK}" + i += 1 + with open(OUT, "w") as f: + json.dump(log, f, indent=1) + return 0.5 + with open(OUT, "w") as f: + json.dump(log, f, indent=1) + bpy.ops.wm.quit_blender() + return None + + +bpy.app.handlers.depsgraph_update_post.append(on_depsgraph) +bpy.app.handlers.undo_post.append(on_undo) +bpy.app.handlers.redo_post.append(on_redo) +bpy.app.timers.register(tick, first_interval=2.0) -- 2.47.3 From 714ae214788e8a1a28e3a2f43af417590a7daacb Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 27 Nov 2026 18:18:59 +0100 Subject: [PATCH 03/13] Live collab target r2: rulings in, phase two authoring surface Takes in the operator's 2026-11-27 rulings (no free-form Python, act then undo, last writer wins in the scene, brokkr-ctl blender built here) and adds phase two: scene collections as an authoring surface over a ship's .cc, opened at known record versions and pushed through AetherDb with a dry-run default and stale-version refusal. Records why neither variants' deltas nor CultNet carry the push today. Co-Authored-By: Claude Opus 5.5 --- docs/live-collab-target.md | 399 ++++++++++++++++++++++--------------- 1 file changed, 243 insertions(+), 156 deletions(-) diff --git a/docs/live-collab-target.md b/docs/live-collab-target.md index acbdb07..228ae83 100644 --- a/docs/live-collab-target.md +++ b/docs/live-collab-target.md @@ -4,200 +4,287 @@ Campaign `brokkr-live` (Nibu's mind). Working branch `nibu/live-collab-target`, `origin/main` 5e279b2. This document holds the rationale, the design truths the campaign produces, and the identity, lifecycle and authority table. The typed `target` in the mind holds the labelled invariants and the not-in-scope list; the -text below is their source. +text below is their source. Revision 2 adds phase two (the authoring surface) and +takes in the operator's rulings of 2026-11-27. + +Rulings in force: `brokkr-live:ruling:no-free-form-python`, `:act-then-undo`, +`:scene-last-writer-wins`, `:brokkr-ctl-blender-built-here`, +`:cc-is-hull-authority-scene-pushes-deltas`. ## Why Operator, 2026-11-27: Brokkr "is meant to give an agent hands into the same Blender -scene I'm looking at, enabling live collaboration work". Brokkr already runs inside -her live Blender: a `depsgraph_update_post` handler publishes a host snapshot and a -persistent 1 s `bpy.app.timers` callback drains command intents -(`surfaces/blender/brokkr_bridge/__init__.py:610-647`, `:668-671`). What it lacks is -everything that makes two people in one scene a collaboration rather than a remote -control: +scene I'm looking at, enabling live collaboration work". Her original vision for it: +"use Blender as an authoring environment, since it exposes typed access to all of the +assets we need over CultMesh. Certain collections within the Blender scene would +mirror their data into the exact documents Aetheria needs for its ships." -- an agent edit is not an undo step (research `nibu-body:research:blender-live-collab.brokkr-undo`); -- nobody can tell who made an edit: the Blender side reads no `requestedBy` - (`.brokkr-attribution-gate`); -- the human cannot stop an agent except by unticking a preference, and a queued intent - still runs if she ticks it back; -- the agent sees names and counts, not the viewport and not the Edit Mode selection - (`.brokkr-perception`); -- nothing stops an agent intent planned against an old scene from overwriting what she - did since; -- the agent has no hands: `brokkr-ctl` has no source (`.brokkr-no-agent-surface`). +So the campaign has two phases. **Phase one** makes the live session a collaboration: +the agent's edits are undoable and attributed, she can stop it, and it sees what she +sees. **Phase two** makes the scene an authoring surface over a ship's `.cc`: scene +collections map to the ship's records, the scene opens from the `.cc` at a known +revision, and pushes go back through AetherDb. -Its strengths stay: typed, validated actions with no free-form Python, path -confinement, loopback bind and an optional session token (`.brokkr-security`). +Brokkr already runs inside her live Blender: a `depsgraph_update_post` handler +publishes a host snapshot and a persistent 1 s `bpy.app.timers` callback drains +command intents (`surfaces/blender/brokkr_bridge/__init__.py:610-647`, `:668-671`). +What it lacks: an agent edit is not an undo step (`nibu-body:research:blender-live-collab.brokkr-undo`); +nobody can tell who made an edit (`.brokkr-attribution-gate`); the human can stop an +agent only by unticking a preference; the agent sees names and counts, not the viewport +or the Edit Mode selection (`.brokkr-perception`); and the agent has no hands, since +`brokkr-ctl` has no source (`.brokkr-no-agent-surface`). Its strengths stay: typed, +validated actions with no free-form Python, path confinement, loopback bind and an +optional session token (`.brokkr-security`). ## Prior art the design stands on -- **mcp-for-blender's `UserEditRecorder`** (`.mcp4b-human-edits`): buffers human - operator and undo/redo events with `undo_post`/`redo_post` handlers, attributes events - during an agent command to the agent, and hands the agent the human's activity before - its next action. We take the idea (the agent learns what the human did) and drop the - trajectory log: the snapshot carries per-object human-edit sequence numbers instead. +- **mcp-for-blender's `UserEditRecorder`** (`.mcp4b-human-edits`): the agent learns what + the human did between its actions. We keep the idea as snapshot fields, without a + trajectory log. - **blender-copilot** (`.copilot-undo-cancel`): one undo step per agent turn, a Stop - button, visible turns and an undo receipt, no approval gate. Its Stop cannot interrupt - a blocking native call. We take all four and accept the same limit. -- **Multi-User** (`.humans-multiuser`) and the paid collab add-ons (`.humans-others`): - presence of the other party in the 3D view, rights and object locks. We take presence - as a panel, derived from intents and receipts; human-to-human replication is theirs, - not ours. + button, visible turns and an undo receipt, no approval gate. Its Stop cannot + interrupt a blocking native call; ours cannot either. +- **Multi-User** (`.humans-multiuser`, `.humans-others`): presence of the other party. + We show presence in a panel; human-to-human replication is theirs. - **Blender Lab MCP and mcp-for-blender** (`.lab-official`, `.mcp4b-perception-safe`): - viewport screenshots as perception; arbitrary code with a weak or default-off - sandbox, and no undo. The perception we copy; the code path is fork Q1. -- **ceeyang/blender_mcp** (`.ceeyang-159`): 159 typed tools, every write undoable. The - existence proof that a typed vocabulary can be wide. -- The brush-tree campaign's `one-commit-primitive` (Libby's mind): a stale base is - refused, never merged. The conflict rule below is the same rule applied to a live scene. + viewport screenshots as perception. Their arbitrary-code path is refused here + (`no-free-form-python`). +- **ceeyang/blender_mcp** (`.ceeyang-159`): 159 typed tools, every write undoable; a + typed vocabulary can be wide. +- **Aetheria's ship package path** (Aetheria origin/master 6702b01bf, packager on + `nibu/hull-packager` 7101b5cec): `AetherDb ship-authoring` (create, stats, price, + product, regenerate with a dry-run default, validate, inspect) loads a `ship.cc` + through the game's own types; `tools/blender/package_hull.py` drives the + `aetheria_ships` add-on and AetherDb from a manifest; `tools/blender/aetheria_ships/ship_cc.py` + reads and writes `ship.cc` envelopes directly, with a layout revision hash for its + layout write. +- **CultCache compare-exchange and element ids** (CultLib origin/main baf4ecf7, + `src/GameCult.Caching/CultCache.cs:2228-2235` `Expect`/`ExpectUnchanged`; + `CultElementIds.cs`). `HardpointData.Id` is a `[CultElementId]` (Aetheria + `Assets/Scripts/ServerShared/ItemData.cs:648`). -## What probing established (Blender 5.3.0, Starfire, GUI, `--factory-startup`) +## What probing established -Probe scripts: `docs/research/live-collab/probe_timer_undo.py` and `probe_look.py`. -Each step runs in its own timer tick, as Brokkr's drain does. +Blender 5.3.0, Starfire, GUI, `--factory-startup`, each step in its own timer tick. +Scripts in `docs/research/live-collab/`. Research notes +`brokkr-live:research:live-collab-probes.*`. -1. **A write from a timer with no undo push is not a step, and it survives undo.** The - cube moved to x=1 with no push; one `ed.undo` left it at x=1. The next push captured - it, so the agent's write became part of the next step, whoever made it (case A). The - vendor warning (`.undo-timer-warning`) is real for unpushed writes, and the failure is - worse than "not undoable": the edit is misattributed. -2. **An explicit `ed.undo_push` from a timer makes a correct step.** x=2 pushed, x=3 - pushed; undo gave 2, undo gave 1 (the earlier step), redo gave 2 (case B). -3. **An UNDO-flagged operator called from a timer pushes its own step.** A sphere added - by `primitive_uv_sphere_add` vanished on one undo with no explicit push (case C). An - action that calls two operators therefore makes two steps unless told otherwise. -4. **Operators called with `undo=False` push nothing; one explicit push then covers - them.** Cube and cone added with `("EXEC_DEFAULT", False)`, one push, one undo removed - both, a second undo changed nothing (case E). This is the mechanism for "one intent, - one step". -5. **Edit Mode:** a bmesh write plus push in Edit Mode is reverted by one undo, and that - undo also left Edit Mode (the agent had entered it in the same probe); the mesh kept - its original vertex (case D). Mode entry and the agent step are not cleanly separable - when the agent itself changed mode. Not yet probed: the human in Edit Mode and the - agent writing. -6. **Driving `ed.undo`/`ed.redo` programmatically from timers crashed Blender 2 of 2 - times** in the long sequence (A through E in one session), with - `EXCEPTION_ACCESS_VIOLATION` in UI draw code after a memfile undo - (`outliner_draw_restrictbuts`, then `psys_get_current` from the properties editor). The - short sequences (C alone, D alone, E alone) did not crash. Cause not isolated; the - probe's own `temp_override` with a captured region is a suspect. -7. **The agent can see what the human sees.** `bpy.ops.screen.screenshot_area` on the - 3D view from a timer: 7 of 7 `FINISHED`, median 72.5 ms over runs 2-7 at 1574x888, - about 609 KB PNG, and it captured the splash screen over the viewport, so it is the - human's view, overlays and popups included. Each capture stalls her UI for that long. -8. **Edit Mode selection reads live** through `bmesh.from_edit_mesh` without leaving Edit - Mode: selected vertices `[0, 3]`, 0.013 ms, mode still `EDIT_MESH`. +1. **An unpushed write from a timer is not an undo step and survives undo**; the next + push absorbs it, so it is misattributed (`.timer-undo`, case A). +2. **An explicit `ed.undo_push` from a timer makes a correct step**, and undo and redo + walk it (case B). +3. **UNDO-flagged operators push their own step**; called `("EXEC_DEFAULT", False)` they + push none, and one explicit push covers several (cases C, E). This is how one intent + becomes one step. +4. **Edit Mode**: an agent bmesh write plus push is reverted by one undo, which also + left the Edit Mode the agent had entered (case D). +5. **Driving `ed.undo`/`ed.redo` from code crashed Blender 2 of 2 times** in the long + sequence, in UI draw after a memfile undo (`.programmatic-undo-crash`). +6. **The agent can see her view**: `screenshot_area` on her 3D view, median 72.5 ms at + 1574x888, about 609 KB, popups included; Edit Mode selection reads live without + leaving Edit Mode (`.look-capture`). +7. **Depsgraph updates from an agent edit arrive inside the timer turn** and name + indirect dependents; after an undo every object is listed and only the transform and + geometry flags show what changed (`.depsgraph-timing`). +8. **cultcache-rs writes the add-on's single-file `.ccmp` under the shared lock, and a + live cultmesh-py node pulls Rust writes**; no runtime has a directory store + (`.rust-store-writer`). -Not yet probed, and owed before the cut that depends on it: whether depsgraph updates -caused by an agent intent arrive inside the timer callback or after it returns (this -decides how human edits are told from agent edits); and whether a human Ctrl+Z inside a -pending agent intent's base window can be detected reliably by `undo_post`. +Not yet probed, owed before the cut that depends on it: the latency of one AetherDb +`ship-authoring` call on Starfire (phase two decides between a CLI call per push and a +resident service on that number); reading a record's stored version through AetherDb. -## Design truths +## Phase one: the live session **One agent turn primitive.** Every agent mutation in Blender goes through one function -in the add-on: admit (sink enabled, `requestedBy` present, id unused, base fresh), run -the action with every operator called `undo=False`, push exactly one undo step labelled -`Brokkr : `, write the receipt. A refusal or a -failure pushes nothing and leaves the scene as it was. Typed actions, the node actions, -and `run` if Q1 keeps it, all use it; there is no second writer. +in the add-on: admit (sink enabled, `requestedBy` present, id unused, action typed and +valid), run the action with every operator called `undo=False`, push exactly one undo +step labelled `Brokkr : `, write the receipt. A +refusal or a failure pushes nothing and leaves the scene unchanged. There is no second +writer and no script action (`no-free-form-python`): what the typed actions do not +cover waits for a new typed action. -**Undo belongs to the human.** Blender's one linear stack is the shared history. The -agent's steps sit in it, labelled, between hers; she undoes them with Ctrl+Z like her -own. The agent never calls `ed.undo` or `ed.redo` (probe 6); an agent that wants to back -out sends a new compensating intent, which is one more step. Undoing an agent step that -sits under later human steps is not offered: Blender's stack is linear and per-user undo -is out of scope. +**The agent acts; the human undoes** (`act-then-undo`). Admitted intents apply without +asking. Blender's one linear undo stack is the shared history; agent steps sit in it, +labelled, between hers, and she takes them back with Ctrl+Z. The agent never calls +`ed.undo` or `ed.redo` (probe 5); it backs out by sending a compensating intent. -**Stop is one control, and only the human holds it.** The Brokkr panel's Stop turns the -command sink off and gives every pending intent a `stopped` receipt without running it. -An action already running finishes (a blocking native call cannot be interrupted, as in -blender-copilot); it is one undo step, so Stop plus Ctrl+Z always returns her scene. No -intent can turn the sink on. Re-enabling is a fresh decision, and intents queued before -Stop never run. +**Last writer wins in the scene** (`scene-last-writer-wins`). An agent intent applies +even if she changed the scene since the agent looked. Her edit is never lost: it stays +in the undo history below the agent's step, and one Ctrl+Z takes the agent's step back. +This is scene-level only; the `.cc` keeps its revision refusal (phase two). + +**Stop is one control, and only the human holds it.** Stop turns the command sink off +and gives every pending intent a `stopped` receipt without running it. An action +already running finishes as one undo step, so Stop plus Ctrl+Z always returns her +scene. No intent can turn the sink on; intents queued before Stop never run. **The agent sees her view and her edits.** `look` is a read intent: it captures her 3D -view to a scratch PNG named by command id (ruling `brush-tree:ruling:look-files-are-scratch`) -and returns the path; it pushes no undo step. The snapshot gains the Edit Mode selection -and a Blender session id plus human-edit sequence numbers: one counter for the session, -the last sequence at which the human touched each object, and the last sequence at which -she undid or redid. The agent reads "what changed since I last looked" from those. +view to a scratch PNG named by command id (`brush-tree:ruling:look-files-are-scratch`) +and returns the path. The snapshot gains the Edit Mode selection, a Blender session id, +and human-edit sequence numbers (a session counter and, per object, the last sequence +at which she changed it, from depsgraph updates outside agent turns and flagged +transform, geometry or shading). These tell the agent what she did since it last +looked; they gate nothing. -**A human edit is never silently overwritten.** Every mutating intent names the base -sequence it was planned against. If the human touched any datablock the intent targets -since that base, or undid or redid since it, or the session id changed, the intent is -refused with a `conflict` receipt naming what changed, and nothing is applied. The -agent looks again and re-plans. Granularity is fork Q3. +**Presence is derived.** The panel shows active agents, the running or last intent with +its one-line `note`, and recent receipts with their undo labels, read from the intent +and receipt documents. -**Presence is derived.** The panel shows which agents have intents or receipts in the -last minutes, the running or last intent with its one-line `note`, and the recent -receipts with their undo labels. It reads the intent and receipt documents; it owns no -state of its own. +**Hands are a CLI** (`brokkr-ctl-blender-built-here`). `brokkr-ctl blender` is a Rust +binary in this repo (`brush-tree:ruling:fitting-home-ruled`) that writes intents and +reads receipts and snapshots in the add-on's single-file store (probe 8), prints plain +text or paths, and whose `--help` is the schema (`brush-tree:ruling:cli-not-mcp`, +`:help-is-the-schema`). It owns no state, policy or ledger. Libby's brush-tree adds its +tree commands to the same binary later. -**Hands are a CLI.** `brokkr-ctl blender` (Rust, ruling `brush-tree:ruling:fitting-home-ruled`) -writes intents and reads receipts and snapshots through the Blender mirror store -(`brush-tree:ruling:blender-transport-ruled`), prints plain text or paths, and its -`--help` is the schema (`brush-tree:ruling:cli-not-mcp`, `:help-is-the-schema`). It owns -no state, policy or ledger (brush-tree target invariant `brokkr-authority-holds`). +## Phase two: the authoring surface + +**The `.cc` is the authority; the scene is a surface over it** +(`cc-is-hull-authority-scene-pushes-deltas`). A ship's records live in its `ship.cc`: +`HullData`, `ShipAuthoring` (model asset, anchors, schematic lines) and its product +records (`ShipAuthoringStore.Load` returns exactly these three). A Blender scene may be +bound to one `ship.cc` as its authoring surface. The scene never becomes truth: it is an +edit buffer that opens from the store and pushes back to it. + +**Collections carry roles.** Scene collections are tagged with the role they author: +hull shape (the hull source and its raster), hardpoint rows (one object per row, +carrying `aetheria.id`, the `HardpointData` element id, and its kind, cell, footprint, +rotation, armor and arc), schematic lines, and anchors. Stats, price and product live on +the binding. These are the fields the packager manifest already names +(`tools/blender/package_hull.md`), so the manifest and a push describe a ship in one +vocabulary. + +**Open reads through the game's code.** Opening runs `AetherDb ship-authoring` to read +the three records and their stored versions, builds the tagged collections, and records +on the binding the version of each record it read. Nothing reads a `.cc` by scraping +envelopes (operator 2026-11-17). + +**A push is one AetherDb call, dry-run then apply.** The surface writes the authoring +state of its tagged collections (the manifest vocabulary, plus the record versions it +opened at) to a scratch request file and calls `AetherDb ship-authoring push +`. Without `apply` AetherDb loads the store, derives the records the request +describes, validates them, and prints the per-record, per-field changes; nothing is +written. With `apply` it does the same and writes under compare-exchange on each +record's stored version (`Expect`). One CLI call per push is the starting shape; a +resident service is built only if the measured latency of that call demands it. + +**A stale revision is refused, never merged.** If any record changed in the store since +the scene opened it (another push, a CLI `stats` call, a packager `--replace`), the push +is refused with the records named; the surface reopens and the author re-applies. On a +successful apply the binding takes the new versions. + +**One owner turns a hull into records.** AetherDb's ship-authoring code (C#, the game's +own types) is the only code that derives `HullData`, `ShipAuthoring` and product records +from authoring input, and the only writer of `.cc` stores. The packager and the +authoring surface both call it. The direct envelope writes in +`aetheria_ships/ship_cc.py` (`replace_lines`, `replace_visual`, `replace_layout`, and +the first Save Layout that creates `ship.cc`) and its `layout_revision` hash are +demoted: `ship_cc.py` keeps no write path and no revision of its own, and +`package_hull.py`'s Save Layout steps become push calls. Whether the request is +the delta of the ruling, or a whole-record replace, is fork Q5 below. + +**The agent's hands reach the surface through typed actions.** Open, push dry-run and +push apply are typed Brokkr actions like any other, admitted by the same primitive; a +push changes no scene state and so pushes no undo step. Whether an agent may apply, +not only dry-run, is fork Q7. + +### Variants and CultNet deltas: not the push primitive today + +The coordinator asked whether Libby's `variants` delta records, or CultNet's deltas, +are the primitive for the push. + +- **Variants** (`variants` target, Libby's mind): a variant is a persisted record stored + as a base reference plus sparse overrides (`CultVariantDelta`, `CultVariantOverride` + with `Set`/`Insert`/`Remove` at slot plus element-id paths, + `src/GameCult.Caching/CultVariants.cs:56-112`), resolved by the cache at load, and a + plain upsert at a variant's key is refused (`variants:ruling:q1-refuse-plain-upsert`). + It describes a second document defined against a base, not a change to the base. Its + nested paths and `Insert`/`Remove` are unbuilt (`variants:follow_up:remaining-variant-cuts`, + C2b), C# alone resolves it, and Aetheria catalog content is out of its scope. +- **CultNet** (`contracts/cultnet/`): the wire has whole-document `document-put` and + `document-put-raw`, `document-delete`, and `database-change-raw` (added, updated, + removed, with the whole document and a commit id). There is no delta message. The + "delta" in `cultnet-rs/src/replication.rs:97,789-829` and `cultmesh-py/node.py:1649-1660` + is a client-side reconciliation diff (predicted minus canonical, per top-level slot, + numeric subtraction) handed to the caller to smooth a prediction; it is never sent. +- **One mechanism?** Not today. They are two unrelated things that share a word. The + operator's recollection matches the plan, not the code: variants' fork ruling 4 + (`cultnet-deltas`) says variants travel on CultNet as deltas, and + `variants:ruling:hop-subscriptions-refuse-variants` holds CultNet off variants until + that cut (C5) lands. When it does, the override vocabulary will be both the stored + variant and the wire delta. +- **Consequence for the push.** The push invents no delta format. Its addressing is the + variants override vocabulary (slot plus element id; `HardpointData.Id` is already a + `[CultElementId]`) when CultLib can apply overrides to a record in place; until then + it is a whole-record replace of the records that changed, guarded by `Expect`. Fork Q5. ## Authority map -- **Owner.** The add-on's agent turn primitive owns whether and how an agent intent - changes the live scene. Blender owns scene truth and the undo stack. The human owns - the sink toggle, Stop, and undo. -- **Inputs.** Intent documents; the snapshot's human-edit sequences; the sink toggle. -- **Outputs.** One undo step per accepted mutating intent; one receipt per intent; - the refreshed snapshot; look PNG paths. -- **Derived state.** Presence (from intents and receipts). Human-edit sequences - (from depsgraph and undo handlers, observations only). Look PNGs (telemetry). -- **Forbidden writers.** `execute_command` called outside the primitive; operators - called with undo on inside an agent action; any raw RNA write by an agent without the - closing push; `ed.undo`/`ed.redo` from add-on code; the debug-mirror JSON import - (`blender_target.py` `_import_debug_command_files`) as a second door for intents; - `brokkr-ctl` opening the store to decide anything. +- **Owner.** Phase one: the add-on's agent turn primitive owns whether and how an agent + intent changes the live scene; Blender owns scene truth and the undo stack; the human + owns the sink toggle, Stop and undo. Phase two: the `ship.cc` owns the ship; + AetherDb's ship-authoring code alone derives and writes its records. +- **Inputs.** Intent documents and the sink toggle (phase one). The tagged collections, + the binding's opened versions and the request file (phase two). +- **Outputs.** One undo step per accepted mutating intent; one receipt per intent; the + refreshed snapshot; look PNG paths; AetherDb's dry-run diff or its write. +- **Derived state.** Presence; human-edit sequences; look PNGs; the scene's mapped + collections (an edit buffer over the `.cc`); the request file. +- **Forbidden writers.** `execute_command` called around the primitive; operators run + with undo on inside an agent action; unpushed agent writes; `ed.undo`/`ed.redo` from + add-on code; any agent-sent Python; the debug-mirror JSON import as a door for intents + (`blender_target.py` `_import_debug_command_files`); `brokkr-ctl` deciding anything; + `ship_cc.py`'s envelope writes and any other direct `.cc` writer; `layout_revision` + as a revision. - **Shared paths.** brokkr-ctl intents, panel buttons that act on the scene, sync-organ - intents from `brokkr-daemon sync-once`, and replayed intents use the one primitive. + intents and replayed intents use the one primitive. The packager, the authoring + surface's buttons and an agent's push intent use the one AetherDb push. - **Deletion line.** The debug-mirror intent import goes before the primitive lands; - `drain_commands` stops calling `execute_command` directly. + `drain_commands` stops calling `execute_command` directly. `ship_cc.py`'s write + functions and `layout_revision` go when the push lands. ## Identity, lifecycle and authority | Persistent kind | What names it | What happens to it over time | Who decides | |---|---|---|---| -| Blender command intent `brokkr.blender.command_intent.v0` (gains `requestedBy`, `baseSeq`, `note`) | `blender/commands/{commandId}`; ids single-use, minted by the writer (Unity F6 A, `brush-tree:ruling:blender-sink-mirrors-unity`) | Written once by a caller. Executed at most once or refused. Removed when its receipt is written, as today. Never rewritten. | Callers write. The agent turn primitive alone decides admission and execution. | -| Blender command receipt `brokkr.blender.command_receipt.v0` (gains `requestedBy`, `outcome` in accepted, denied, conflict, stopped, failed, `undoLabel`, `lookPath`, and for `run` the script text and SHA-256) | `blender/receipts/{commandId}`, one per intent | Written once, after the primitive decides. Pruned by count with Unity's cap and prune rule. The only proof an intent ran. | The primitive alone. Callers and the panel read. | -| Agent identity `requestedBy` | `/` stated by the caller (brokkr-ctl takes it from `EUREKA_INSTANCE` and a flag) | Carried on each intent into its receipt and undo label; not stored on its own. | The caller states it; the primitive refuses an intent without it. The session token proves admission, not identity. | -| Agent undo step | Blender undo stack entry labelled `Brokkr : ` | Pushed once per accepted mutating intent; lives as Blender's stack does (step limit, file load); never persisted by Brokkr. | Blender owns the stack. The primitive pushes. Only the human undoes or redoes. | -| Blender session id | uuid minted at add-on register and on each `load_post` | Replaced when Blender restarts or a file loads; every older base is then stale. | The add-on alone. | -| Human-edit sequences (snapshot fields: `humanEditSeq`, per-object `lastHumanEditSeq`, `lastUndoSeq`) | Integers within a session id | Monotonic within a session; reset with it. Observations, never scene truth. | The add-on's depsgraph and undo handlers alone. | -| Host snapshot `brokkr.blender.host_snapshot.v0` (gains Edit Mode selection, session id, the sequences above, sink state) | `blender/host/current`, overwritten | Refreshed on depsgraph update and after each intent. | The add-on alone. | -| Command sink toggle (the existing `auto_drain_commands` preference) | Add-on preference, echoed in the snapshot | Off by default. Stop turns it off; only the human turns it on. | The human only. No intent writes it. | -| Script toggle (only if Q1 = b) | A second add-on preference, echoed in the snapshot | Off by default, independent of the sink. | The human only. | -| Look PNG | `/look/{commandId}.png` | Pruned by count; never read back as truth. | The primitive writes; `brush-tree:ruling:look-files-are-scratch` governs. | +| Blender command intent `brokkr.blender.command_intent.v0` (gains `requestedBy`, `note`) | `blender/commands/{commandId}`; ids single-use, minted by the writer (`brush-tree:ruling:blender-sink-mirrors-unity`) | Written once by a caller. Executed at most once or refused. Removed when its receipt is written. Never rewritten. | Callers write. The agent turn primitive alone decides admission and execution. | +| Blender command receipt `brokkr.blender.command_receipt.v0` (gains `requestedBy`, `outcome` in accepted, denied, stopped, failed, `undoLabel`, `lookPath`) | `blender/receipts/{commandId}`, one per intent | Written once, after the primitive decides. Pruned by count with Unity's cap and prune rule. | The primitive alone. Callers and the panel read. | +| Agent identity `requestedBy` | `/` stated by the caller | Carried on each intent into its receipt and undo label; not stored on its own. | The caller states it; the primitive refuses an intent without it. The session token proves admission, not identity. | +| Agent undo step | Blender undo entry `Brokkr : ` | One per accepted mutating intent; lives as Blender's stack does; never persisted by Brokkr. | Blender owns the stack; the primitive pushes; only the human undoes or redoes. | +| Blender session id | uuid minted at add-on register and on each `load_post` | Replaced when Blender restarts or a file loads. | The add-on alone. | +| Human-edit sequences (snapshot: `humanEditSeq`, per-object `lastHumanEditSeq`) | Integers within a session id | Monotonic within a session; reset with it. Information for the agent; they gate nothing. | The add-on's depsgraph and undo handlers alone. | +| Host snapshot `brokkr.blender.host_snapshot.v0` (gains Edit Mode selection, session id, sequences, sink state, authoring binding summary) | `blender/host/current`, overwritten | Refreshed on depsgraph update and after each intent. | The add-on alone. | +| Command sink toggle (`auto_drain_commands`) | Add-on preference, echoed in the snapshot | Off by default. Stop turns it off; only the human turns it on. | The human only. | +| Look PNG | `/look/{commandId}.png` | Pruned by count; never read back as truth. | The primitive writes; `look-files-are-scratch` governs. | +| Ship package store `ship.cc` (`HullData`, `ShipAuthoring`, product records) | Its path, `GameData/Mods//ship.cc`; records by their keys | Created by `ship-authoring create`; changed only by AetherDb commands, each write minting new stored versions (`variants:ruling:storedat-on-change`); replaced whole only by packager `--replace`. | AetherDb's ship-authoring code is the only writer. | +| Record version | The version CultCache's compare-exchange tests for each record key | Changes on every write that changes the record's bytes. | CultCache mints it; AetherDb reports it on open and tests it on apply. | +| Authoring binding | A custom property on the Blender scene: the `ship.cc` path relative to the `.blend`, the ship id, and the record versions opened at | Set on Open; versions replaced after each successful apply; cleared on Detach or reopen. Lives in the `.blend`. | Open, apply and Detach (human buttons or agent actions through the primitive) alone write it. | +| Collection role | A custom property on a collection: hull, hardpoints, lines or anchors | Set when the surface builds or the author tags a collection; removed on Detach. | The author; the surface's Open builds the defaults. | +| Hardpoint row identity | `aetheria.id` on the row's object, equal to `HardpointData.Id` (`[CultElementId]`) | Minted when the row is created; survives renames and moves; removing the object removes the row on the next push. | AetherDb mints for a new row; the surface carries it. | +| Push request | `/authoring/{commandId}.json`, manifest vocabulary plus opened versions | Written per push; pruned by count; never read back as state. | The surface writes; AetherDb alone interprets it. | ## Not in scope -Human-to-human replication or several Blender instances in one session (Multi-User's -domain). Agents on another host reaching the operator's Blender: the transport is not -widened beyond what the add-on serves today. Per-user or selective undo. An approval gate -before each agent action (unless Q2 rules otherwise). A 3D-view overlay of the agent's -presence; the panel carries presence in this revision. The Unity surface and -`brokkr-command`. The brush-tree vocabulary, Geometry.Csg and OpenSCAD text (brush-tree -owns them). Agent-initiated save and quit (`brush-tree:ruling:run-admitted-when-enabled` -keeps them off the allowed list). Asset libraries and generators. An MCP server. +Human-to-human replication or several Blender instances in one session. Agents on +another host reaching the operator's Blender. Per-user or selective undo. An approval +gate (`act-then-undo`). Stale-action refusal inside the live scene +(`scene-last-writer-wins`). Any agent-sent Python (`no-free-form-python`). A 3D-view +presence overlay. The Unity surface and `brokkr-command`. The brush-tree vocabulary, +Geometry.Csg and OpenSCAD text (brush-tree owns them). Agent-initiated save and quit. +Asset libraries and generators. An MCP server. Records outside a ship package +(catalog loadouts, factions) unless Q6 rules them in. A new delta wire format. ## Open forks (draft questions; Self admits) -- **Q1. Free-form Python.** Today the Blender add-on has no script action. Libby's - Defaulted ruling `brush-tree:ruling:run-admitted-when-enabled` would add `run`, admitted - whenever agent commands are on. Options: (a) typed actions only; (b) `run` behind its - own off-by-default toggle, one undo step, script text in the receipt; (c) the Defaulted - ruling as written. Recommend (b). -- **Q2. Act then undo, or approve first.** Recommend act then undo, with Stop. -- **Q3. Conflict granularity.** (a) any human edit since the base refuses; (b) only edits to - the intent's targets, plus any undo or redo. Recommend (b), after the depsgraph - attribution probe. -- **Q4. Who builds `brokkr-ctl blender`.** Recommend this campaign builds the session - subcommands in Rust per Libby's rulings, and brush-tree adds its tree commands to the - same binary later. +- **Q5. What a push carries.** (a) whole records that changed, under `Expect`, now; (b) + variants override paths applied in place, after CultLib builds in-place apply and + C2b; (c) (a) now with the request shaped so (b) replaces it without changing the + surface. Recommend (c). +- **Q6. Does a ship's loadout belong in its package?** A package holds hull, authoring + and products today; loadouts are catalog records. Recommend not in r2. +- **Q7. May an agent apply a push, or only dry-run?** A `.cc` write has no Ctrl+Z. + Recommend dry-run for agents, apply by her button. +- **Q8. Where the authoring surface lives.** (a) the `aetheria_ships` add-on in Aetheria, + with Brokkr giving the agent typed actions that call it; (b) Brokkr's add-on gains + Aetheria vocabulary. Recommend (a). -- 2.47.3 From 847c28714bc58d37b2e8f30ae1cc1f6088121828 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 27 Nov 2026 18:20:10 +0100 Subject: [PATCH 04/13] Live collab target r2: the push request is a stdin dump, as the material path Co-Authored-By: Claude Opus 5.5 --- docs/live-collab-target.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/live-collab-target.md b/docs/live-collab-target.md index 228ae83..13592ad 100644 --- a/docs/live-collab-target.md +++ b/docs/live-collab-target.md @@ -160,10 +160,11 @@ the three records and their stored versions, builds the tagged collections, and on the binding the version of each record it read. Nothing reads a `.cc` by scraping envelopes (operator 2026-11-17). -**A push is one AetherDb call, dry-run then apply.** The surface writes the authoring +**A push is one AetherDb call, dry-run then apply.** The surface pipes the authoring state of its tagged collections (the manifest vocabulary, plus the record versions it -opened at) to a scratch request file and calls `AetherDb ship-authoring push -`. Without `apply` AetherDb loads the store, derives the records the request +opened at) as a structural JSON dump on stdin to `AetherDb ship-authoring push `, +as the material path does (`aetheria-release:ruling:blender-dump-stdin`): never written +to disk, parsed and judged only in C#, so the schema exists once. Without `apply` AetherDb loads the store, derives the records the request describes, validates them, and prints the per-record, per-field changes; nothing is written. With `apply` it does the same and writes under compare-exchange on each record's stored version (`Expect`). One CLI call per push is the starting shape; a @@ -226,11 +227,11 @@ are the primitive for the push. owns the sink toggle, Stop and undo. Phase two: the `ship.cc` owns the ship; AetherDb's ship-authoring code alone derives and writes its records. - **Inputs.** Intent documents and the sink toggle (phase one). The tagged collections, - the binding's opened versions and the request file (phase two). + the binding's opened versions and the stdin dump (phase two). - **Outputs.** One undo step per accepted mutating intent; one receipt per intent; the refreshed snapshot; look PNG paths; AetherDb's dry-run diff or its write. - **Derived state.** Presence; human-edit sequences; look PNGs; the scene's mapped - collections (an edit buffer over the `.cc`); the request file. + collections (an edit buffer over the `.cc`); the stdin dump (a pipe, not state). - **Forbidden writers.** `execute_command` called around the primitive; operators run with undo on inside an agent action; unpushed agent writes; `ed.undo`/`ed.redo` from add-on code; any agent-sent Python; the debug-mirror JSON import as a door for intents @@ -262,7 +263,6 @@ are the primitive for the push. | Authoring binding | A custom property on the Blender scene: the `ship.cc` path relative to the `.blend`, the ship id, and the record versions opened at | Set on Open; versions replaced after each successful apply; cleared on Detach or reopen. Lives in the `.blend`. | Open, apply and Detach (human buttons or agent actions through the primitive) alone write it. | | Collection role | A custom property on a collection: hull, hardpoints, lines or anchors | Set when the surface builds or the author tags a collection; removed on Detach. | The author; the surface's Open builds the defaults. | | Hardpoint row identity | `aetheria.id` on the row's object, equal to `HardpointData.Id` (`[CultElementId]`) | Minted when the row is created; survives renames and moves; removing the object removes the row on the next push. | AetherDb mints for a new row; the surface carries it. | -| Push request | `/authoring/{commandId}.json`, manifest vocabulary plus opened versions | Written per push; pruned by count; never read back as state. | The surface writes; AetherDb alone interprets it. | ## Not in scope -- 2.47.3 From bebc004f09fcfdb32937dd19553ca7383e7daee7 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 27 Nov 2026 18:32:47 +0100 Subject: [PATCH 05/13] Blender: one agent turn primitive, run_intent (live-2) Every intent is admitted (commandId unused, requestedBy /, typed action), run with operator undo off, pushed as one labelled undo step, and receipted with requestedBy, note and undoLabel. execute_command becomes the private _dispatch. A refusal before any write pushes nothing; a raise after one pushes a '(failed)' step. Live GUI test: Edit Mode object-level write is not reverted by one undo (reported). Co-Authored-By: Claude Sonnet 5.5 --- docs/live-collab-target.md | 4 +- .../blender/brokkr_bridge/blender_target.py | 152 +++++++++++----- .../blender/tests/live/agent_turn_undo.py | 170 ++++++++++++++++++ .../tests/live/agent_turn_undo.result.json | 167 +++++++++++++++++ surfaces/blender/tests/live/gn_actions.py | 4 +- surfaces/blender/tests/live/gn_recreation.py | 4 +- surfaces/blender/tests/live/headless_smoke.py | 2 +- .../blender/tests/live/material_colour.py | 2 +- surfaces/blender/tests/test_agent_turn.py | 90 ++++++++++ .../blender/tests/test_material_actions.py | 21 ++- surfaces/blender/tests/test_node_actions.py | 16 +- surfaces/blender/tests/test_scene_actions.py | 36 +++- 12 files changed, 604 insertions(+), 64 deletions(-) create mode 100644 surfaces/blender/tests/live/agent_turn_undo.py create mode 100644 surfaces/blender/tests/live/agent_turn_undo.result.json create mode 100644 surfaces/blender/tests/test_agent_turn.py diff --git a/docs/live-collab-target.md b/docs/live-collab-target.md index 13592ad..aee7181 100644 --- a/docs/live-collab-target.md +++ b/docs/live-collab-target.md @@ -100,7 +100,9 @@ resident service on that number); reading a record's stored version through Aeth in the add-on: admit (sink enabled, `requestedBy` present, id unused, action typed and valid), run the action with every operator called `undo=False`, push exactly one undo step labelled `Brokkr : `, write the receipt. A -refusal or a failure pushes nothing and leaves the scene unchanged. There is no second +refusal caught before any write pushes nothing and leaves the scene unchanged; an action +that fails after writing pushes one step labelled `(failed)`, so the partial write is one +undoable step. There is no second writer and no script action (`no-free-form-python`): what the typed actions do not cover waits for a new typed action. diff --git a/surfaces/blender/brokkr_bridge/blender_target.py b/surfaces/blender/brokkr_bridge/blender_target.py index 677f03d..a3156c0 100644 --- a/surfaces/blender/brokkr_bridge/blender_target.py +++ b/surfaces/blender/brokkr_bridge/blender_target.py @@ -5,6 +5,7 @@ import functools import json import math import os +import re import sys import uuid from array import array @@ -43,6 +44,16 @@ CREATABLE_OBJECT_TYPES = ("MESH", "LIGHT", "CAMERA", "EMPTY") GL_RENDER_ENGINES = ("BLENDER_WORKBENCH", "BLENDER_EEVEE", "BLENDER_EEVEE_NEXT") GL_RUNTIME_LIBRARY = "libEGL.so.1" +# Actions that only read the scene and so push no undo step (live-5 adds look). +READ_ACTIONS: tuple[str, ...] = () +MUTATING_ACTIONS = ( + "createObject", "deleteObject", "setObjectTransform", "setObjectVisibility", "setObjectParent", + "setObjectCustomProperty", "selectObject", "assignMaterial", "importGltf", "exportGltf", + "setCamera", "setLight", "setWorld", "renderStill", +) +REQUESTED_BY_SHAPE = re.compile(r"^[A-Za-z0-9._-]+/[A-Za-z0-9._-]+$") +NOTE_LIMIT = 200 + EVALUATED_POSITION_CAP = 256 EVALUATED_VERTEX_LIMIT = 1_000_000 EVALUATED_INSTANCE_SCAN_LIMIT = 100_000 # depsgraph items visited per capture; iterating one in Python costs ~5 us @@ -92,6 +103,8 @@ class BrokkrBlenderTarget: self.import_dir: str = "" self.output_dir: str = "" self.nodes = na.NodeActions(bpy_module) + self.agent_turn = False # true only inside run_intent + self._receipted: set[str] = set() def configure_action_dirs(self, import_dir: str, output_dir: str) -> None: """The directories importGltf and renderStill may touch; empty leaves that action disabled.""" @@ -133,9 +146,11 @@ class BrokkrBlenderTarget: snapshot = node.database.snapshot() commands = snapshot.get(COMMAND_INTENT_SCHEMA, {}) receipts: list[dict[str, Any]] = [] + self._receipted.update( + r.get("commandId", "") for r in snapshot.get(COMMAND_RECEIPT_SCHEMA, {}).values()) for command_key, command in sorted(commands.items()): - receipt = self.execute_command(context, command) + receipt = self.run_intent(context, command) self.publish_receipt(cache_path, cultlib_py_src, receipt, debug_mirror_root) node.database.delete(documents["command_intent"], command_key) receipts.append(receipt) @@ -488,45 +503,89 @@ class BrokkrBlenderTarget: "collections": [self._collection_snapshot(collection) for collection in bpy.data.collections], } - def execute_command(self, context: Any, command: dict[str, Any]) -> dict[str, Any]: + def run_intent(self, context: Any, command: dict[str, Any]) -> dict[str, Any]: + """The one agent turn: admit, run with operator undo off, push one labelled undo step, receipt.""" + command_id = command.get("commandId") + requested_by = command.get("requestedBy") action = command.get("action", "") + denial = "" + if not isinstance(command_id, str) or not command_id: + denial = "Intent has no commandId." + elif command_id in self._receipted: + denial = f"commandId {command_id!r} was already receipted; ids are single-use." + elif not isinstance(requested_by, str) or not REQUESTED_BY_SHAPE.match(requested_by): + denial = "Intent has no requestedBy of the form '/'." + elif action not in MUTATING_ACTIONS and action not in READ_ACTIONS and action not in na.NodeActions.ACTIONS: + denial = f"Unsupported Blender command action: {action}" + if denial: + if isinstance(command_id, str) and command_id: + self._receipted.add(command_id) + return self._receipt(command, "denied", denial, "") + + label = f"Brokkr {requested_by}: {action} {command_id[:8]}" + push = action not in READ_ACTIONS + self.agent_turn = True try: - if action == "createObject": - return self._create_object(context, command) - if action == "deleteObject": - return self._delete_object(context, command) - if action == "setObjectTransform": - return self._set_object_transform(context, command) - if action == "setObjectVisibility": - return self._set_object_visibility(context, command) - if action == "setObjectParent": - return self._set_object_parent(context, command) - if action == "setObjectCustomProperty": - return self._set_object_custom_property(context, command) - if action == "selectObject": - return self._select_object(context, command) - if action == "assignMaterial": - return self._assign_material(context, command) - if action == "importGltf": - return self._import_gltf(context, command) - if action == "exportGltf": - return self._export_gltf(context, command) - if action == "setCamera": - return self._set_camera(context, command) - if action == "setLight": - return self._set_light(context, command) - if action == "setWorld": - return self._set_world(context, command) - if action == "renderStill": - return self._render_still(context, command) - if action in na.NodeActions.ACTIONS: - message, name = self.nodes.execute(action, command) - return self._receipt(command, "accepted", message, name) - return self._receipt(command, "failed", f"Unsupported Blender command action: {action}", "") - except sa.ActionRefused as error: - return self._receipt(command, "failed", str(error), "") - except Exception as error: - return self._receipt(command, "failed", str(error), "") + try: + receipt = self._dispatch(context, command) + if receipt["status"] != "accepted": + push = False # returned a refusal: it wrote nothing + except sa.ActionRefused as error: # raised before any write: nothing to push + receipt, push = self._receipt(command, "failed", str(error), ""), False + except Exception as error: # a partial write is one undoable step, not part of her next action + label += " (failed)" + receipt = self._receipt(command, "failed", str(error), "") + if push: + self._push_undo(label) + receipt["undoLabel"] = label + finally: + self.agent_turn = False + self._receipted.add(command_id) + return receipt + + def _push_undo(self, label: str) -> None: + windows = self.bpy.context.window_manager.windows + if windows: + with self.bpy.context.temp_override(window=windows[0]): + self.bpy.ops.ed.undo_push(message=label) + else: + self.bpy.ops.ed.undo_push(message=label) + + def _dispatch(self, context: Any, command: dict[str, Any]) -> dict[str, Any]: + """The action table. Only run_intent calls it; it owns refusal, failure and the undo step.""" + action = command.get("action", "") + if action == "createObject": + return self._create_object(context, command) + if action == "deleteObject": + return self._delete_object(context, command) + if action == "setObjectTransform": + return self._set_object_transform(context, command) + if action == "setObjectVisibility": + return self._set_object_visibility(context, command) + if action == "setObjectParent": + return self._set_object_parent(context, command) + if action == "setObjectCustomProperty": + return self._set_object_custom_property(context, command) + if action == "selectObject": + return self._select_object(context, command) + if action == "assignMaterial": + return self._assign_material(context, command) + if action == "importGltf": + return self._import_gltf(context, command) + if action == "exportGltf": + return self._export_gltf(context, command) + if action == "setCamera": + return self._set_camera(context, command) + if action == "setLight": + return self._set_light(context, command) + if action == "setWorld": + return self._set_world(context, command) + if action == "renderStill": + return self._render_still(context, command) + if action in na.NodeActions.ACTIONS: + message, name = self.nodes.execute(action, command) + return self._receipt(command, "accepted", message, name) + return self._receipt(command, "failed", f"Unsupported Blender command action: {action}", "") def _create_object(self, context: Any, command: dict[str, Any]) -> dict[str, Any]: object_type = command.get("objectType", "EMPTY") @@ -542,13 +601,13 @@ class BrokkrBlenderTarget: location = _vector(command.get("location"), 3, (0.0, 0.0, 0.0)) if object_type == "MESH": - self.bpy.ops.mesh.primitive_cube_add(size=float(command.get("size", 1.0)), location=location) + self.bpy.ops.mesh.primitive_cube_add("EXEC_DEFAULT", False, size=float(command.get("size", 1.0)), location=location) elif object_type == "LIGHT": - self.bpy.ops.object.light_add(type=command.get("lightType", "POINT"), location=location) + self.bpy.ops.object.light_add("EXEC_DEFAULT", False, type=command.get("lightType", "POINT"), location=location) elif object_type == "CAMERA": - self.bpy.ops.object.camera_add(location=location) + self.bpy.ops.object.camera_add("EXEC_DEFAULT", False, location=location) else: # EMPTY - self.bpy.ops.object.empty_add(type=command.get("emptyDisplayType", "PLAIN_AXES"), location=location) + self.bpy.ops.object.empty_add("EXEC_DEFAULT", False, type=command.get("emptyDisplayType", "PLAIN_AXES"), location=location) obj = context.object obj.name = name @@ -662,7 +721,7 @@ class BrokkrBlenderTarget: (sa.fingerprint([path]), sa.fingerprint(existing)) != checked: raise sa.ActionRefused("Import file changed while it was being checked.") before = set(self.bpy.data.objects.keys()) - self.bpy.ops.import_scene.gltf(filepath=str(path)) + self.bpy.ops.import_scene.gltf("EXEC_DEFAULT", False, filepath=str(path)) added = sorted(set(self.bpy.data.objects.keys()) - before) return self._receipt(command, "accepted", f"Imported {len(added)} object(s) from {path.name}.", added[0] if added else "") @@ -708,7 +767,7 @@ class BrokkrBlenderTarget: try: for obj in objects: obj.select_set(obj in chosen) - result = self.bpy.ops.export_scene.gltf( + result = self.bpy.ops.export_scene.gltf("EXEC_DEFAULT", False, filepath=str(path), export_format="GLB" if suffix == ".glb" else "GLTF_SEPARATE", use_selection=bool(chosen), **options) finally: @@ -848,7 +907,7 @@ class BrokkrBlenderTarget: path.parent.mkdir(parents=True, exist_ok=True) if sa.resolve_inside(self.output_dir, name, "output", new_file=True) != path: raise sa.ActionRefused("Output path changed while it was being checked.") - self.bpy.ops.render.render(write_still=True) + self.bpy.ops.render.render("EXEC_DEFAULT", False, write_still=True) finally: (render.engine, render.resolution_x, render.resolution_y, render.filepath, render.image_settings.file_format, scene.camera) = saved @@ -1013,6 +1072,9 @@ class BrokkrBlenderTarget: "status": status, "message": message, "objectName": object_name, + "requestedBy": command["requestedBy"] if isinstance(command.get("requestedBy"), str) else "", + "note": command["note"][:NOTE_LIMIT] if isinstance(command.get("note"), str) else "", + "undoLabel": "", "observedAt": _now(), } diff --git a/surfaces/blender/tests/live/agent_turn_undo.py b/surfaces/blender/tests/live/agent_turn_undo.py new file mode 100644 index 0000000..c41ca89 --- /dev/null +++ b/surfaces/blender/tests/live/agent_turn_undo.py @@ -0,0 +1,170 @@ +"""Live proof, in GUI Blender, that every agent intent is one undo step. + + BROKKR_ADDON= \ + blender --factory-startup --python agent_turn_undo.py -- + +Writes .result.json beside , then quits Blender. Each step is its own timer tick so the +event loop runs between steps, as it does for Brokkr's 1 s drain (probe_timer_undo.py pattern). +Undo is read only here, by this driver; the add-on never calls ed.undo or ed.redo. +Exit status is not meaningful in a GUI session: read the "ok" fields of the result. +""" +import json +import os +import sys +import traceback +import types +from pathlib import Path + +import bpy + +ADDON = Path(os.environ["BROKKR_ADDON"]).resolve() +pkg = types.ModuleType("brokkr_bridge"); pkg.__path__ = [str(ADDON)] +sys.modules["brokkr_bridge"] = pkg +from brokkr_bridge import blender_target as bt + +OUT = sys.argv[sys.argv.index("--") + 1] +R = {"blender": bpy.app.version_string, "background": bpy.app.background, "checks": [], "steps": []} +target = bt.BrokkrBlenderTarget(bpy) +N = [0] + + +def check(name, ok, detail=None): + R["checks"].append({"name": name, "ok": bool(ok), "detail": detail}) + + +def win(): + w = bpy.context.window_manager.windows[0] + return bpy.context.temp_override(window=w) + + +def intent(**cmd): + N[0] += 1 + cmd.setdefault("commandId", "%08d-live-agent-turn" % N[0]) + cmd.setdefault("requestedBy", "nibu/hands") + r = target.run_intent(bpy.context, cmd) + R["steps"].append({"intent": cmd["action"], "status": r["status"], "undoLabel": r["undoLabel"], "message": r["message"]}) + return r + + +def undo(): + with win(): + bpy.ops.ed.undo() + + +def push(msg): + with win(): + bpy.ops.ed.undo_push(message=msg) + + +def loc(name): + o = bpy.data.objects.get(name) + return None if o is None else [round(v, 3) for v in o.location] + + +def names(): + return sorted(o.name for o in bpy.data.objects) + + +S = {} + + +def s_baseline(): + push("driver baseline") + S["objects0"] = names() + + +def s_create(): + r = intent(action="createObject", objectType="MESH", name="AgentCube", location=[3, 0, 0]) + check("createObject accepted with undoLabel", r["status"] == "accepted" and r["undoLabel"].startswith("Brokkr nibu/hands: createObject "), r["undoLabel"]) + + +def s_transform(): + intent(action="setObjectTransform", objectName="AgentCube", location=[3, 2, 0]) + check("transform applied", loc("AgentCube") == [3.0, 2.0, 0.0], loc("AgentCube")) + + +def s_undo_transform(): + undo() + check("one undo reverts only the transform step", "AgentCube" in names() and loc("AgentCube") == [3.0, 0.0, 0.0], + {"objects": names(), "loc": loc("AgentCube")}) + + +def s_undo_create(): + undo() + check("one undo reverts createObject (cube_add, rename, location) together", names() == S["objects0"], names()) + + +def s_denied_setup(): + intent(action="createObject", objectType="MESH", name="AgentCube2", location=[0, 5, 0]) + r = intent(action="createObject", objectType="MESH", requestedBy="", name="Intruder") + check("denied intent: status denied, scene unchanged", r["status"] == "denied" and "Intruder" not in names(), r["status"]) + check("denied intent: no undoLabel", r["undoLabel"] == "", r["undoLabel"]) + + +def s_denied_undo(): + undo() + check("denied intent pushed nothing: one undo removes the preceding accepted intent", names() == S["objects0"], names()) + + +def s_edit_enter(): + cube = bpy.data.objects["Cube"] + bpy.context.view_layer.objects.active = cube + cube.select_set(True) + with win(): + bpy.ops.object.mode_set(mode="EDIT") + S["loc0"] = loc("Cube") + push("driver edit-mode baseline") + R["editMode"] = {"mode_before": bpy.context.mode, "loc_before": S["loc0"]} + + +def s_edit_agent(): + r = intent(action="setObjectTransform", objectName="Cube", location=[0, 0, 5]) + R["editMode"].update(mode_after_intent=bpy.context.mode, loc_after_intent=loc("Cube"), receipt=r["status"], undoLabel=r["undoLabel"]) + check("edit mode: agent transform applied", loc("Cube") == [0.0, 0.0, 5.0], loc("Cube")) + + +def s_edit_undo(): + undo() + R["editMode"].update(mode_after_undo=bpy.context.mode, loc_after_undo=loc("Cube")) + check("edit mode: one undo reverts the agent transform", loc("Cube") == S["loc0"], R["editMode"]) + + +def s_edit_undo_again(): + """Diagnostic, not a check: where does the object-level write sit relative to Edit Mode steps?""" + undo() + R["editMode"].update(mode_after_second_undo=bpy.context.mode, loc_after_second_undo=loc("Cube")) + + +def s_exit(): + if bpy.context.mode != "OBJECT": + with win(): + bpy.ops.object.mode_set(mode="OBJECT") + + +steps = [s_baseline, s_create, s_transform, s_undo_transform, s_undo_create, s_denied_setup, s_denied_undo, + s_edit_enter, s_edit_agent, s_edit_undo, s_edit_undo_again, s_exit] +i = 0 + + +def write(): + R["ok"] = bool(R["checks"]) and all(c["ok"] for c in R["checks"]) and not any("error" in s for s in R["steps"]) + with open(OUT + ".result.json", "w") as f: + json.dump(R, f, indent=1) + + +def tick(): + global i + if i < len(steps): + try: + steps[i]() + except Exception: + R["steps"].append({"step": steps[i].__name__, "error": traceback.format_exc()}) + i += 1 + write() + return 0.5 + write() + bpy.ops.wm.quit_blender() + return None + + +bpy.app.timers.register(tick, first_interval=2.0) diff --git a/surfaces/blender/tests/live/agent_turn_undo.result.json b/surfaces/blender/tests/live/agent_turn_undo.result.json new file mode 100644 index 0000000..5ae93a7 --- /dev/null +++ b/surfaces/blender/tests/live/agent_turn_undo.result.json @@ -0,0 +1,167 @@ +{ + "blender": "5.3.0", + "background": false, + "checks": [ + { + "name": "createObject accepted with undoLabel", + "ok": true, + "detail": "Brokkr nibu/hands: createObject 00000001" + }, + { + "name": "transform applied", + "ok": true, + "detail": [ + 3.0, + 2.0, + 0.0 + ] + }, + { + "name": "one undo reverts only the transform step", + "ok": true, + "detail": { + "objects": [ + "AgentCube", + "Camera", + "Cube", + "Light" + ], + "loc": [ + 3.0, + 0.0, + 0.0 + ] + } + }, + { + "name": "one undo reverts createObject (cube_add, rename, location) together", + "ok": true, + "detail": [ + "Camera", + "Cube", + "Light" + ] + }, + { + "name": "denied intent: status denied, scene unchanged", + "ok": true, + "detail": "denied" + }, + { + "name": "denied intent: no undoLabel", + "ok": true, + "detail": "" + }, + { + "name": "denied intent pushed nothing: one undo removes the preceding accepted intent", + "ok": true, + "detail": [ + "Camera", + "Cube", + "Light" + ] + }, + { + "name": "edit mode: agent transform applied", + "ok": true, + "detail": [ + 0.0, + 0.0, + 5.0 + ] + }, + { + "name": "edit mode: one undo reverts the agent transform", + "ok": false, + "detail": { + "mode_before": "EDIT_MESH", + "loc_before": [ + 0.0, + 0.0, + 0.0 + ], + "mode_after_intent": "EDIT_MESH", + "loc_after_intent": [ + 0.0, + 0.0, + 5.0 + ], + "receipt": "accepted", + "undoLabel": "Brokkr nibu/hands: setObjectTransform 00000005", + "mode_after_undo": "EDIT_MESH", + "loc_after_undo": [ + 0.0, + 0.0, + 5.0 + ], + "mode_after_second_undo": "OBJECT", + "loc_after_second_undo": [ + 0.0, + 0.0, + 0.0 + ] + } + } + ], + "steps": [ + { + "intent": "createObject", + "status": "accepted", + "undoLabel": "Brokkr nibu/hands: createObject 00000001", + "message": "Blender object created." + }, + { + "intent": "setObjectTransform", + "status": "accepted", + "undoLabel": "Brokkr nibu/hands: setObjectTransform 00000002", + "message": "Blender object transform updated." + }, + { + "intent": "createObject", + "status": "accepted", + "undoLabel": "Brokkr nibu/hands: createObject 00000003", + "message": "Blender object created." + }, + { + "intent": "createObject", + "status": "denied", + "undoLabel": "", + "message": "Intent has no requestedBy of the form '/'." + }, + { + "intent": "setObjectTransform", + "status": "accepted", + "undoLabel": "Brokkr nibu/hands: setObjectTransform 00000005", + "message": "Blender object transform updated." + } + ], + "ok": false, + "editMode": { + "mode_before": "EDIT_MESH", + "loc_before": [ + 0.0, + 0.0, + 0.0 + ], + "mode_after_intent": "EDIT_MESH", + "loc_after_intent": [ + 0.0, + 0.0, + 5.0 + ], + "receipt": "accepted", + "undoLabel": "Brokkr nibu/hands: setObjectTransform 00000005", + "mode_after_undo": "EDIT_MESH", + "loc_after_undo": [ + 0.0, + 0.0, + 5.0 + ], + "mode_after_second_undo": "OBJECT", + "loc_after_second_undo": [ + 0.0, + 0.0, + 0.0 + ] + } +} \ No newline at end of file diff --git a/surfaces/blender/tests/live/gn_actions.py b/surfaces/blender/tests/live/gn_actions.py index 1d9e329..62df949 100644 --- a/surfaces/blender/tests/live/gn_actions.py +++ b/surfaces/blender/tests/live/gn_actions.py @@ -4,7 +4,7 @@ blender -b --factory-startup --python gn_actions.py -- result.json Each native tree is built with bpy as the reference and evaluated with the depsgraph. The Brokkr side -uses BrokkrBlenderTarget.execute_command for every build step and capture_snapshot().objects[].evaluated +uses BrokkrBlenderTarget.run_intent for every build step and capture_snapshot().objects[].evaluated for every read: no bpy call touches the Brokkr-built scene except the harness's own reference trees. Exit status is non-zero if any check fails. """ @@ -29,7 +29,7 @@ def fresh(): N = [0] def act(t, **cmd): N[0] += 1; cmd.setdefault("commandId", "c%d" % N[0]) - r = t.execute_command(bpy.context, cmd) + r = t.run_intent(bpy.context, dict(cmd, requestedBy="test/driver")) if r["status"] != "accepted": print("REFUSED", cmd["action"], r["message"], flush=True) return r diff --git a/surfaces/blender/tests/live/gn_recreation.py b/surfaces/blender/tests/live/gn_recreation.py index 6ef8036..f8127d9 100644 --- a/surfaces/blender/tests/live/gn_recreation.py +++ b/surfaces/blender/tests/live/gn_recreation.py @@ -4,7 +4,7 @@ blender -b --factory-startup --python gn_recreation.py -- result.json Each setup is built twice: natively (geometry-nodes tree via bpy, evaluated) and through -BrokkrBlenderTarget.execute_command using only the actions that exist. Prints GAP lines where an +BrokkrBlenderTarget.run_intent using only the actions that exist. Prints GAP lines where an action that would be needed is refused or has no effect. Not part of the unittest run (needs Blender). """ import bpy, sys, os, json, types, math, random @@ -25,7 +25,7 @@ def reset(): def act(t, **cmd): cmd.setdefault("commandId", "c%d" % act.n); act.n += 1 - return t.execute_command(bpy.context, cmd) + return t.run_intent(bpy.context, dict(cmd, requestedBy="test/driver")) act.n = 0 def gap(key, **detail): diff --git a/surfaces/blender/tests/live/headless_smoke.py b/surfaces/blender/tests/live/headless_smoke.py index 085df0c..1d21601 100644 --- a/surfaces/blender/tests/live/headless_smoke.py +++ b/surfaces/blender/tests/live/headless_smoke.py @@ -43,7 +43,7 @@ results = [] def run(label, **cmd): cmd.setdefault("commandId", label) try: - r = target.execute_command(bpy.context, cmd) + r = target.run_intent(bpy.context, dict(cmd, requestedBy="test/driver")) except Exception: r = {"status": "EXCEPTION", "message": traceback.format_exc()} print("RESULT", label, r["status"], r.get("message", "").replace("\n", " | ")[:400], flush=True) diff --git a/surfaces/blender/tests/live/material_colour.py b/surfaces/blender/tests/live/material_colour.py index 4b43135..07c2f4d 100644 --- a/surfaces/blender/tests/live/material_colour.py +++ b/surfaces/blender/tests/live/material_colour.py @@ -26,7 +26,7 @@ cube = bpy.context.active_object N = [0] def act(**cmd): N[0] += 1; cmd.setdefault("commandId", "c%d" % N[0]); cmd["action"] = "assignMaterial"; cmd["targetObjectName"] = cube.name - return t.execute_command(bpy.context, cmd) + return t.run_intent(bpy.context, dict(cmd, requestedBy="test/driver")) def base(): return tuple(round(c, 6) for c in bpy.data.materials["oxide red"].node_tree.nodes["Principled BSDF"].inputs["Base Color"].default_value) diff --git a/surfaces/blender/tests/test_agent_turn.py b/surfaces/blender/tests/test_agent_turn.py new file mode 100644 index 0000000..353f709 --- /dev/null +++ b/surfaces/blender/tests/test_agent_turn.py @@ -0,0 +1,90 @@ +"""run_intent: admission, one labelled undo step, receipts. A fake bpy records ops calls.""" +from __future__ import annotations + +import re +import unittest +import unittest.mock +from pathlib import Path + +import test_scene_actions as ts + +bt = ts.bt +SOURCE = Path(bt.__file__) + + +class AgentTurnTests(unittest.TestCase): + """Reuses the scene fixture (fake bpy, temp import/output dirs).""" + setUp = ts.ActionTests.setUp + run_action = ts.ActionTests.run_action + + def test_intent_without_requested_by_is_denied(self): + receipt = self.run_action(action="createObject", objectType="EMPTY", requestedBy="") + self.assertEqual(receipt["status"], "denied") + self.assertEqual(self.bpy.created, []) + self.assertEqual(self.bpy.undo.pushes, []) + receipt = self.run_action(action="createObject", objectType="EMPTY", requestedBy="nibu") + self.assertEqual(receipt["status"], "denied") + self.assertEqual(self.bpy.created, []) + + def test_unknown_action_is_denied(self): + self.assertEqual(self.run_action(action="runPython")["status"], "denied") + self.assertEqual(self.bpy.undo.pushes, []) + + def test_reused_command_id_is_denied(self): + first = self.run_action(action="createObject", objectType="EMPTY", commandId="same-id-1") + self.assertEqual(first["status"], "accepted") + second = self.run_action(action="createObject", objectType="EMPTY", commandId="same-id-1") + self.assertEqual(second["status"], "denied") + self.assertEqual(len(self.bpy.created), 1) + self.assertEqual(len(self.bpy.undo.pushes), 1) + + def test_accepted_receipt_carries_undo_label(self): + receipt = self.run_action(action="createObject", objectType="EMPTY", + commandId="abcdef0123456789", requestedBy="nibu/hands", note="x" * 300) + label = "Brokkr nibu/hands: createObject abcdef01" + self.assertEqual(self.bpy.undo.pushes, [label]) + self.assertEqual(receipt["undoLabel"], label) + self.assertEqual(receipt["requestedBy"], "nibu/hands") + self.assertEqual(len(receipt["note"]), 200) + + def test_refusal_pushes_nothing(self): + receipt = self.run_action(action="createObject", objectType="BOGUS") + self.assertEqual(receipt["status"], "failed") + self.assertEqual(receipt["undoLabel"], "") + self.assertEqual(self.bpy.undo.pushes, []) + + def test_read_action_pushes_nothing(self): + with unittest.mock.patch.object(bt, "READ_ACTIONS", ("createObject",)): + self.run_action(action="createObject", objectType="EMPTY") + self.assertEqual(self.bpy.undo.pushes, []) + + def test_raise_after_admission_pushes_failed_step(self): + def boom(*a, **kw): + raise RuntimeError("half done") + self.bpy.ops.object.empty_add = boom + receipt = self.run_action(action="createObject", objectType="EMPTY", commandId="deadbeef99") + self.assertEqual(receipt["status"], "failed") + self.assertEqual(self.bpy.undo.pushes, ["Brokkr nibu/hands: createObject deadbeef (failed)"]) + + def test_agent_turn_flag_is_scoped(self): + seen = [] + original = self.bpy.ops.object.empty_add + self.bpy.ops.object.empty_add = lambda *a, **kw: (seen.append(self.target.agent_turn), original(*a, **kw))[1] + self.run_action(action="createObject", objectType="EMPTY") + self.assertEqual(seen, [True]) + self.assertFalse(self.target.agent_turn) + + def test_operators_called_with_undo_false(self): + self.assertEqual(self.run_action(action="exportGltf", filepath="o.glb")["status"], "accepted") + self.assertEqual(self.run_action(action="importGltf", filepath="model.glb")["status"], "accepted") + self.assertEqual(self.run_action(action="renderStill", outputPath="r.png", engine="CYCLES")["status"], "accepted") + for kind in ("MESH", "LIGHT", "CAMERA", "EMPTY"): + self.assertEqual(self.run_action(action="createObject", objectType=kind)["status"], "accepted") + # the fake ops assert ("EXEC_DEFAULT", False); the source pattern pins the spelling too + bad = re.findall(r'bpy\.ops\.(?:mesh|object|import_scene|export_scene|render)\.[a-z_]+\((?!"EXEC_DEFAULT", False)', + SOURCE.read_text(encoding="utf-8")) + self.assertEqual(bad, []) + + +if __name__ == "__main__": + unittest.main() diff --git a/surfaces/blender/tests/test_material_actions.py b/surfaces/blender/tests/test_material_actions.py index 9ecc2ec..0caa663 100644 --- a/surfaces/blender/tests/test_material_actions.py +++ b/surfaces/blender/tests/test_material_actions.py @@ -5,6 +5,9 @@ The real API is exercised by tests/live/material_colour.py. """ from __future__ import annotations +import contextlib +import itertools + import sys import types import unittest @@ -50,11 +53,25 @@ class Materials(dict): return self[name] +IDS = itertools.count() + + +class FakeUndo: + """What run_intent needs of bpy: a window to override and ed.undo_push, recorded.""" + def __init__(self, bpy): + self.pushes = [] + bpy.context = NS(window_manager=NS(windows=[object()]), temp_override=lambda **kw: contextlib.nullcontext()) + ops = getattr(bpy, "ops", None) or NS() + ops.ed = NS(undo_push=lambda message: self.pushes.append(message)) + bpy.ops = ops + + class FakeBpy: def __init__(self): self.mesh = NS(name="Cube", type="MESH", data=NS(materials=[])) self.empty = NS(name="Empty", type="EMPTY", data=None) self.data = NS(objects={"Cube": self.mesh, "Empty": self.empty}, materials=Materials()) + self.undo = FakeUndo(self) class MaterialTests(unittest.TestCase): @@ -63,7 +80,7 @@ class MaterialTests(unittest.TestCase): self.target = bt.BrokkrBlenderTarget(self.bpy) def assign(self, **fields): - return self.target.execute_command(NS(), {"commandId": "c1", "action": "assignMaterial", + return self.target.run_intent(NS(), {"commandId": f"c{next(IDS)}", "requestedBy": "nibu/hands", "action": "assignMaterial", "targetObjectName": "Cube", **fields}) def base_color(self, name="oxide red"): @@ -137,7 +154,7 @@ class MaterialTests(unittest.TestCase): self.assertEqual(self.base_color("bare"), (0.2, 0.3, 0.4, 1.0)) def test_object_without_material_slots_is_refused(self): - receipt = self.target.execute_command(NS(), {"commandId": "c", "action": "assignMaterial", + receipt = self.target.run_intent(NS(), {"commandId": f"c{next(IDS)}", "requestedBy": "nibu/hands", "action": "assignMaterial", "targetObjectName": "Empty", "color": [1, 0, 0]}) self.assertEqual(receipt["status"], "failed") self.assertEqual(dict(self.bpy.data.materials), {}) diff --git a/surfaces/blender/tests/test_node_actions.py b/surfaces/blender/tests/test_node_actions.py index 4c333f1..eac602f 100644 --- a/surfaces/blender/tests/test_node_actions.py +++ b/surfaces/blender/tests/test_node_actions.py @@ -5,6 +5,8 @@ The real API is exercised by tests/live/gn_actions.py. """ from __future__ import annotations +import contextlib + import sys import types import unittest @@ -168,9 +170,20 @@ class Obj: self.custom = (key, value) +class FakeUndo: + """What run_intent needs of bpy: a window to override and ed.undo_push, recorded.""" + def __init__(self, bpy): + self.pushes = [] + bpy.context = NS(window_manager=NS(windows=[object()]), temp_override=lambda **kw: contextlib.nullcontext()) + ops = getattr(bpy, "ops", None) or NS() + ops.ed = NS(undo_push=lambda message: self.pushes.append(message)) + bpy.ops = ops + + class FakeBpy: def __init__(self): self.data = NS(node_groups=Groups(), objects={"Host": Obj("Host")}) + self.undo = FakeUndo(self) class NodeActionTests(unittest.TestCase): @@ -182,7 +195,8 @@ class NodeActionTests(unittest.TestCase): def run_action(self, **command): self.n += 1 command.setdefault("commandId", f"c{self.n}") - return self.target.execute_command(None, command) + command.setdefault("requestedBy", "nibu/hands") + return self.target.run_intent(None, command) def accepted(self, **command): receipt = self.run_action(**command) diff --git a/surfaces/blender/tests/test_scene_actions.py b/surfaces/blender/tests/test_scene_actions.py index bb3a292..c60b657 100644 --- a/surfaces/blender/tests/test_scene_actions.py +++ b/surfaces/blender/tests/test_scene_actions.py @@ -4,6 +4,7 @@ Run: python3 -m unittest discover -s surfaces/blender/tests -v """ from __future__ import annotations +import contextlib import json import os import struct @@ -69,6 +70,16 @@ class Objects(dict): """bpy.data.objects: a mapping with keys() and get().""" +class FakeUndo: + """What run_intent needs of bpy: a window to override and ed.undo_push, recorded.""" + def __init__(self, bpy): + self.pushes = [] + bpy.context = NS(window_manager=NS(windows=[object()]), temp_override=lambda **kw: contextlib.nullcontext()) + ops = getattr(bpy, "ops", None) or NS() + ops.ed = NS(undo_push=lambda message: self.pushes.append(message)) + bpy.ops = ops + + class FakeBpy: def __init__(self): self.imported = [] @@ -95,14 +106,16 @@ class FakeBpy: o.selected = o is self.mesh o.select_get = (lambda o=o: o.selected) o.select_set = (lambda state, o=o: setattr(o, "selected", state)) - add = lambda kind: (lambda **kw: self.add_object(kind, kw)) + add = lambda kind: (lambda mode, undo, **kw: self.add_object(kind, kw, (mode, undo))) self.ops = NS(import_scene=NS(gltf=self.import_gltf), render=NS(render=self.render_still), export_scene=NS(gltf=self.export_gltf), mesh=NS(primitive_cube_add=add("MESH")), object=NS(light_add=add("LIGHT"), camera_add=add("CAMERA"), empty_add=add("EMPTY"))) self.on_add = lambda obj: None + self.undo = FakeUndo(self) - def add_object(self, kind, kwargs): + def add_object(self, kind, kwargs, call=("EXEC_DEFAULT", False)): + assert call == ("EXEC_DEFAULT", False), call # operators run with undo off self.created.append((kind, kwargs)) obj = NS(name=kind.title(), type=kind) self.data.objects[obj.name] = obj @@ -115,18 +128,21 @@ class FakeBpy: world.background = background return world - def import_gltf(self, filepath): + def import_gltf(self, mode, undo, filepath): + assert (mode, undo) == ("EXEC_DEFAULT", False) self.imported.append(filepath) self.data.objects["Imported"] = NS(name="Imported", type="MESH", data=None) - def export_gltf(self, **kwargs): + def export_gltf(self, mode, undo, **kwargs): + assert (mode, undo) == ("EXEC_DEFAULT", False) kwargs["selected_at_call"] = sorted(o.name for o in self.data.objects.values() if o.selected) self.exported.append(kwargs) if self.export_writes: Path(kwargs["filepath"]).write_bytes(b"x" * 10) return self.export_result - def render_still(self, write_still): + def render_still(self, mode, undo, write_still): + assert (mode, undo) == ("EXEC_DEFAULT", False) r = self.scene.render self.rendered.append((r.engine, r.resolution_x, r.resolution_y, r.filepath, r.image_settings.file_format, self.scene.camera)) @@ -149,8 +165,10 @@ class ActionTests(unittest.TestCase): self.bpy.on_add = lambda obj: setattr(self.context, "object", obj) def run_action(self, **command): - command.setdefault("commandId", "c1") - return self.target.execute_command(self.context, command) + self.n = getattr(self, "n", 0) + 1 + command.setdefault("commandId", f"c{self.n:07d}") + command.setdefault("requestedBy", "nibu/hands") + return self.target.run_intent(self.context, command) # importGltf def test_import_inside_the_import_dir_runs(self): @@ -289,7 +307,7 @@ class ActionTests(unittest.TestCase): self.assertFalse((self.root / "out" / "b.glb").exists()) def test_export_selection_restored_when_the_exporter_raises(self): - def boom(**kw): + def boom(*a, **kw): raise RuntimeError("exporter blew up") self.bpy.ops.export_scene.gltf = boom receipt = self.run_action(action="exportGltf", filepath="a.glb", selection=["Cam"]) @@ -362,7 +380,7 @@ class ActionTests(unittest.TestCase): self.assertIsNone(self.bpy.scene.camera) def test_render_still_restores_settings_when_the_render_fails(self): - def boom(write_still): + def boom(*a, **kw): raise RuntimeError("render failed") self.bpy.ops.render.render = boom self.assertEqual(self.run_action(action="renderStill", outputPath="a.png", engine="CYCLES")["status"], "failed") -- 2.47.3 From 6464915fa42e5eb3dee1114bb7a7f7aeed0202e2 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 27 Nov 2026 18:35:25 +0100 Subject: [PATCH 06/13] Blender: refuse object-level intents while an object is in Edit Mode Ruling brokkr-live:ruling:object-intents-refused-in-edit-mode. The guard denies before any write, so nothing is pushed and her mode is untouched. Live check measured in Blender 5.3.0: refused, scene and undo stack unchanged. Co-Authored-By: Claude Sonnet 5.5 --- .../blender/brokkr_bridge/blender_target.py | 12 +++ .../blender/tests/live/agent_turn_undo.py | 31 +++++--- .../tests/live/agent_turn_undo.result.json | 76 +++++++++++-------- surfaces/blender/tests/test_agent_turn.py | 13 ++++ 4 files changed, 90 insertions(+), 42 deletions(-) diff --git a/surfaces/blender/brokkr_bridge/blender_target.py b/surfaces/blender/brokkr_bridge/blender_target.py index a3156c0..3b9a81a 100644 --- a/surfaces/blender/brokkr_bridge/blender_target.py +++ b/surfaces/blender/brokkr_bridge/blender_target.py @@ -51,6 +51,9 @@ MUTATING_ACTIONS = ( "setObjectCustomProperty", "selectObject", "assignMaterial", "importGltf", "exportGltf", "setCamera", "setLight", "setWorld", "renderStill", ) +# While an object is in Edit Mode, undo steps are edit-mesh steps and an object-level write is not +# reverted by one undo (brokkr-live:ruling:object-intents-refused-in-edit-mode). These touch no object. +EDIT_MODE_SAFE_ACTIONS = ("setWorld", "exportGltf", "renderStill") REQUESTED_BY_SHAPE = re.compile(r"^[A-Za-z0-9._-]+/[A-Za-z0-9._-]+$") NOTE_LIMIT = 200 @@ -517,6 +520,9 @@ class BrokkrBlenderTarget: denial = "Intent has no requestedBy of the form '/'." elif action not in MUTATING_ACTIONS and action not in READ_ACTIONS and action not in na.NodeActions.ACTIONS: denial = f"Unsupported Blender command action: {action}" + elif action not in EDIT_MODE_SAFE_ACTIONS and self._edit_mode_object() is not None: + denial = (f"Object {self._edit_mode_object()!r} is in Edit Mode: object-level intents are refused " + "until she leaves it; nothing was changed.") if denial: if isinstance(command_id, str) and command_id: self._receipted.add(command_id) @@ -543,6 +549,12 @@ class BrokkrBlenderTarget: self._receipted.add(command_id) return receipt + def _edit_mode_object(self) -> str | None: + for obj in self.bpy.data.objects.values(): + if getattr(obj, "mode", "OBJECT") == "EDIT": + return obj.name + return None + def _push_undo(self, label: str) -> None: windows = self.bpy.context.window_manager.windows if windows: diff --git a/surfaces/blender/tests/live/agent_turn_undo.py b/surfaces/blender/tests/live/agent_turn_undo.py index c41ca89..75716ee 100644 --- a/surfaces/blender/tests/live/agent_turn_undo.py +++ b/surfaces/blender/tests/live/agent_turn_undo.py @@ -15,6 +15,7 @@ import traceback import types from pathlib import Path +import bmesh import bpy ADDON = Path(os.environ["BROKKR_ADDON"]).resolve() @@ -68,6 +69,11 @@ def names(): S = {} +def vz(): + bm = bmesh.from_edit_mesh(bpy.data.objects["Cube"].data); bm.verts.ensure_lookup_table() + return round(bm.verts[0].co.z, 3) + + def s_baseline(): push("driver baseline") S["objects0"] = names() @@ -114,25 +120,28 @@ def s_edit_enter(): bpy.ops.object.mode_set(mode="EDIT") S["loc0"] = loc("Cube") push("driver edit-mode baseline") + S["z0"] = vz() + bm = bmesh.from_edit_mesh(cube.data); bm.verts.ensure_lookup_table(); bm.verts[0].co.z += 5.0 + bmesh.update_edit_mesh(cube.data) + push("her edit-mesh edit") R["editMode"] = {"mode_before": bpy.context.mode, "loc_before": S["loc0"]} def s_edit_agent(): r = intent(action="setObjectTransform", objectName="Cube", location=[0, 0, 5]) - R["editMode"].update(mode_after_intent=bpy.context.mode, loc_after_intent=loc("Cube"), receipt=r["status"], undoLabel=r["undoLabel"]) - check("edit mode: agent transform applied", loc("Cube") == [0.0, 0.0, 5.0], loc("Cube")) + R["editMode"].update(mode_after_intent=bpy.context.mode, loc_after_intent=loc("Cube"), receipt=r["status"], + message=r["message"], undoLabel=r["undoLabel"]) + check("edit mode: object-level intent refused, scene and her mode unchanged", + r["status"] == "denied" and "Edit Mode" in r["message"] and r["undoLabel"] == "" + and loc("Cube") == S["loc0"] and bpy.context.mode == "EDIT_MESH", R["editMode"]) def s_edit_undo(): + """One undo must revert her edit-mesh step: a step pushed by the refused intent would have taken it.""" undo() - R["editMode"].update(mode_after_undo=bpy.context.mode, loc_after_undo=loc("Cube")) - check("edit mode: one undo reverts the agent transform", loc("Cube") == S["loc0"], R["editMode"]) - - -def s_edit_undo_again(): - """Diagnostic, not a check: where does the object-level write sit relative to Edit Mode steps?""" - undo() - R["editMode"].update(mode_after_second_undo=bpy.context.mode, loc_after_second_undo=loc("Cube")) + R["editMode"].update(mode_after_undo=bpy.context.mode, loc_after_undo=loc("Cube"), z_before=S["z0"] + 5.0, z_after_undo=vz()) + check("edit mode: undo stack unchanged by the refused intent (one undo reverts her edit-mesh step)", + vz() == S["z0"] and loc("Cube") == S["loc0"], R["editMode"]) def s_exit(): @@ -142,7 +151,7 @@ def s_exit(): steps = [s_baseline, s_create, s_transform, s_undo_transform, s_undo_create, s_denied_setup, s_denied_undo, - s_edit_enter, s_edit_agent, s_edit_undo, s_edit_undo_again, s_exit] + s_edit_enter, s_edit_agent, s_edit_undo, s_exit] i = 0 diff --git a/surfaces/blender/tests/live/agent_turn_undo.result.json b/surfaces/blender/tests/live/agent_turn_undo.result.json index 5ae93a7..455335f 100644 --- a/surfaces/blender/tests/live/agent_turn_undo.result.json +++ b/surfaces/blender/tests/live/agent_turn_undo.result.json @@ -62,17 +62,8 @@ ] }, { - "name": "edit mode: agent transform applied", + "name": "edit mode: object-level intent refused, scene and her mode unchanged", "ok": true, - "detail": [ - 0.0, - 0.0, - 5.0 - ] - }, - { - "name": "edit mode: one undo reverts the agent transform", - "ok": false, "detail": { "mode_before": "EDIT_MESH", "loc_before": [ @@ -84,22 +75,48 @@ "loc_after_intent": [ 0.0, 0.0, - 5.0 + 0.0 ], - "receipt": "accepted", - "undoLabel": "Brokkr nibu/hands: setObjectTransform 00000005", + "receipt": "denied", + "message": "Object 'Cube' is in Edit Mode: object-level intents are refused until she leaves it; nothing was changed.", + "undoLabel": "", "mode_after_undo": "EDIT_MESH", "loc_after_undo": [ 0.0, 0.0, - 5.0 + 0.0 ], - "mode_after_second_undo": "OBJECT", - "loc_after_second_undo": [ + "z_before": 6.0, + "z_after_undo": 1.0 + } + }, + { + "name": "edit mode: undo stack unchanged by the refused intent (one undo reverts her edit-mesh step)", + "ok": true, + "detail": { + "mode_before": "EDIT_MESH", + "loc_before": [ 0.0, 0.0, 0.0 - ] + ], + "mode_after_intent": "EDIT_MESH", + "loc_after_intent": [ + 0.0, + 0.0, + 0.0 + ], + "receipt": "denied", + "message": "Object 'Cube' is in Edit Mode: object-level intents are refused until she leaves it; nothing was changed.", + "undoLabel": "", + "mode_after_undo": "EDIT_MESH", + "loc_after_undo": [ + 0.0, + 0.0, + 0.0 + ], + "z_before": 6.0, + "z_after_undo": 1.0 } } ], @@ -130,12 +147,12 @@ }, { "intent": "setObjectTransform", - "status": "accepted", - "undoLabel": "Brokkr nibu/hands: setObjectTransform 00000005", - "message": "Blender object transform updated." + "status": "denied", + "undoLabel": "", + "message": "Object 'Cube' is in Edit Mode: object-level intents are refused until she leaves it; nothing was changed." } ], - "ok": false, + "ok": true, "editMode": { "mode_before": "EDIT_MESH", "loc_before": [ @@ -147,21 +164,18 @@ "loc_after_intent": [ 0.0, 0.0, - 5.0 + 0.0 ], - "receipt": "accepted", - "undoLabel": "Brokkr nibu/hands: setObjectTransform 00000005", + "receipt": "denied", + "message": "Object 'Cube' is in Edit Mode: object-level intents are refused until she leaves it; nothing was changed.", + "undoLabel": "", "mode_after_undo": "EDIT_MESH", "loc_after_undo": [ - 0.0, - 0.0, - 5.0 - ], - "mode_after_second_undo": "OBJECT", - "loc_after_second_undo": [ 0.0, 0.0, 0.0 - ] + ], + "z_before": 6.0, + "z_after_undo": 1.0 } } \ No newline at end of file diff --git a/surfaces/blender/tests/test_agent_turn.py b/surfaces/blender/tests/test_agent_turn.py index 353f709..db950a6 100644 --- a/surfaces/blender/tests/test_agent_turn.py +++ b/surfaces/blender/tests/test_agent_turn.py @@ -26,6 +26,19 @@ class AgentTurnTests(unittest.TestCase): self.assertEqual(receipt["status"], "denied") self.assertEqual(self.bpy.created, []) + def test_object_intent_is_refused_while_an_object_is_in_edit_mode(self): + self.bpy.mesh.mode = "EDIT" + receipt = self.run_action(action="setObjectTransform", objectName="Cube", location=[0, 0, 5]) + self.assertEqual(receipt["status"], "denied") + self.assertIn("Edit Mode", receipt["message"]) + self.assertEqual(receipt["undoLabel"], "") + self.assertEqual(self.bpy.undo.pushes, []) + self.assertEqual(self.bpy.created, []) + self.assertEqual(self.bpy.mesh.mode, "EDIT") # the agent never changes her mode + self.assertEqual(self.run_action(action="renderStill", outputPath="r.png", engine="CYCLES")["status"], "accepted") + self.bpy.mesh.mode = "OBJECT" + self.assertEqual(self.run_action(action="createObject", objectType="EMPTY")["status"], "accepted") + def test_unknown_action_is_denied(self): self.assertEqual(self.run_action(action="runPython")["status"], "denied") self.assertEqual(self.bpy.undo.pushes, []) -- 2.47.3 From 8f8c92e7c906286532d7e31f4849920166195e5a Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 27 Nov 2026 19:09:48 +0100 Subject: [PATCH 07/13] Blender agent turn: Soul s1 fixes Edit Mode refuses setWorld and exportGltf too (only renderStill stays); exportGltf and renderStill push no undo step; receipts are write-once (a reused id's denial goes under .denied); a raise in the undo push is a failed receipt and never re-runs; pin the four surviving branches; queue-level live harness through the node and the add-on timer. Co-Authored-By: Claude Sonnet 5.5 --- .../blender/brokkr_bridge/blender_target.py | 31 ++- .../blender/tests/live/agent_turn_queue.py | 225 ++++++++++++++++++ .../tests/live/agent_turn_queue.result.json | 196 +++++++++++++++ .../blender/tests/live/agent_turn_undo.py | 34 ++- .../tests/live/agent_turn_undo.result.json | 131 ++++++++++ surfaces/blender/tests/test_agent_turn.py | 96 ++++++++ surfaces/blender/tests/test_scene_actions.py | 5 +- 7 files changed, 708 insertions(+), 10 deletions(-) create mode 100644 surfaces/blender/tests/live/agent_turn_queue.py create mode 100644 surfaces/blender/tests/live/agent_turn_queue.result.json diff --git a/surfaces/blender/brokkr_bridge/blender_target.py b/surfaces/blender/brokkr_bridge/blender_target.py index 3b9a81a..2528bbc 100644 --- a/surfaces/blender/brokkr_bridge/blender_target.py +++ b/surfaces/blender/brokkr_bridge/blender_target.py @@ -51,9 +51,13 @@ MUTATING_ACTIONS = ( "setObjectCustomProperty", "selectObject", "assignMaterial", "importGltf", "exportGltf", "setCamera", "setLight", "setWorld", "renderStill", ) -# While an object is in Edit Mode, undo steps are edit-mesh steps and an object-level write is not -# reverted by one undo (brokkr-live:ruling:object-intents-refused-in-edit-mode). These touch no object. -EDIT_MODE_SAFE_ACTIONS = ("setWorld", "exportGltf", "renderStill") +# Actions that change no scene state: they push no undo step (exportGltf restores its selection; +# renderStill restores its settings). +NO_SCENE_CHANGE_ACTIONS = ("exportGltf", "renderStill") +# While an object is in Edit Mode, undo steps are edit-mesh steps, so a scene write is not reverted by +# one undo, and some operators leave Edit Mode (brokkr-live:ruling:object-intents-refused-in-edit-mode). +# Anything that writes scene state or changes her mode is refused; renderStill does neither. +EDIT_MODE_SAFE_ACTIONS = ("renderStill",) REQUESTED_BY_SHAPE = re.compile(r"^[A-Za-z0-9._-]+/[A-Za-z0-9._-]+$") NOTE_LIMIT = 200 @@ -153,8 +157,12 @@ class BrokkrBlenderTarget: r.get("commandId", "") for r in snapshot.get(COMMAND_RECEIPT_SCHEMA, {}).values()) for command_key, command in sorted(commands.items()): + reused = command.get("commandId") in self._receipted receipt = self.run_intent(context, command) - self.publish_receipt(cache_path, cultlib_py_src, receipt, debug_mirror_root) + # Receipts are write-once: a reused id's denial goes under '.denied', never over the + # original. The sender learns of it by reading that key (and the drain's returned list). + self.publish_receipt(cache_path, cultlib_py_src, receipt, debug_mirror_root, + key_suffix=".denied" if reused else "") node.database.delete(documents["command_intent"], command_key) receipts.append(receipt) @@ -166,8 +174,9 @@ class BrokkrBlenderTarget: cultlib_py_src: str, receipt: dict[str, Any], debug_mirror_root: str = "", + key_suffix: str = "", ) -> None: - command_id = receipt.get("commandId") or uuid.uuid4().hex + command_id = (receipt.get("commandId") or uuid.uuid4().hex) + key_suffix node, documents = self._open_node(cache_path, cultlib_py_src) node.database.put(documents["command_receipt"], f"blender/receipts/{command_id}", receipt) if debug_mirror_root: @@ -529,7 +538,7 @@ class BrokkrBlenderTarget: return self._receipt(command, "denied", denial, "") label = f"Brokkr {requested_by}: {action} {command_id[:8]}" - push = action not in READ_ACTIONS + push = action not in READ_ACTIONS and action not in NO_SCENE_CHANGE_ACTIONS self.agent_turn = True try: try: @@ -542,8 +551,14 @@ class BrokkrBlenderTarget: label += " (failed)" receipt = self._receipt(command, "failed", str(error), "") if push: - self._push_undo(label) - receipt["undoLabel"] = label + try: + self._push_undo(label) + receipt["undoLabel"] = label + except Exception as error: # the write stands; the intent is receipted, never re-run + receipt = self._receipt( + command, "failed", + f"{receipt['message']} The undo step could not be pushed ({error}); the change stands " + "but is not one undo step.", receipt["objectName"]) finally: self.agent_turn = False self._receipted.add(command_id) diff --git a/surfaces/blender/tests/live/agent_turn_queue.py b/surfaces/blender/tests/live/agent_turn_queue.py new file mode 100644 index 0000000..e44669a --- /dev/null +++ b/surfaces/blender/tests/live/agent_turn_queue.py @@ -0,0 +1,225 @@ +"""Live proof, in GUI Blender with the add-on enabled, that intents arriving through the node queue +are drained by the add-on's own 1 s timer as one undo step each, with write-once receipts. + + BROKKR_USER_SCRIPTS= (also BLENDER_USER_SCRIPTS) + BROKKR_SCRATCH= + BROKKR_PYLIBS= + blender --factory-startup --python agent_turn_queue.py -- + +Intents are put into the node database as brokkr-ctl does (no debug-mirror files). Writes +.result.json, then quits Blender. Undo is read only here, by this driver. +""" +import json +import os +import sys +import traceback +from pathlib import Path + +import bpy + +if os.environ.get("BROKKR_PYLIBS"): + sys.path.insert(0, os.environ["BROKKR_PYLIBS"]) +SCRATCH = Path(os.environ["BROKKR_SCRATCH"]).resolve() +SCRATCH.mkdir(parents=True, exist_ok=True) +OUT = sys.argv[sys.argv.index("--") + 1] +R = {"blender": bpy.app.version_string, "checks": [], "receipts": {}} + +bpy.ops.preferences.addon_enable(module="brokkr_bridge") +import brokkr_bridge as addon # noqa: E402 +from brokkr_bridge import blender_target as bt # noqa: E402 + +prefs = bpy.context.preferences.addons["brokkr_bridge"].preferences +CACHE = str(SCRATCH / "queue.ccmp") +prefs.cultmesh_cache_path = CACHE +prefs.debug_mirror_root = "" # the debug-mirror door is not used here +prefs.output_dir = str(SCRATCH / "out") +prefs.import_dir = "" +prefs.auto_drain_commands = True +(SCRATCH / "out").mkdir(exist_ok=True) +adapter = addon.target() + + +def check(name, ok, detail=None): + R["checks"].append({"name": name, "ok": bool(ok), "detail": detail}) + + +def win(): + return bpy.context.temp_override(window=bpy.context.window_manager.windows[0]) + + +def undo(): + with win(): + bpy.ops.ed.undo() + + +def push(msg): + with win(): + bpy.ops.ed.undo_push(message=msg) + + +def node(): + return adapter._open_node(CACHE, prefs.cultlib_py_src) + + +def queue(cid, **cmd): + n, docs = node() + cmd.update(commandId=cid, schema=bt.COMMAND_INTENT_SCHEMA) + n.database.put(docs["command_intent"], f"blender/commands/{cid}", cmd) + + +def receipt(key): + n, _ = node() + return n.database.snapshot().get(bt.COMMAND_RECEIPT_SCHEMA, {}).get(f"blender/receipts/{key}") + + +def pending(): + n, _ = node() + return n.database.snapshot().get(bt.COMMAND_INTENT_SCHEMA, {}) + + +def names(): + return sorted(o.name for o in bpy.data.objects) + + +S = {} +WAIT = {"ticks": 0} + + +def until(pred, limit=24): + """A step that repeats each tick until pred() holds (the add-on's timer drains meanwhile).""" + def step(): + WAIT["ticks"] += 1 + if pred(): + WAIT["ticks"] = 0 + return True + if WAIT["ticks"] > limit: + raise TimeoutError("drain did not receipt in time") + return False + return step + + +def once(fn): + def step(): + fn() + return True + return step + + +def drained(*ids): + return lambda: all(receipt(i) for i in ids) + + +def q1(): + push("driver baseline") + queue("aaaaaaaa-0001", action="createObject", objectType="MESH", name="QCube", location=[4, 0, 0], + requestedBy="nibu/hands", note="queue test") + + +def q1_check(): + r = receipt("aaaaaaaa-0001") + R["receipts"]["q1"] = r + S["q1_label"] = r and r.get("undoLabel") + check("queue: createObject drained by the add-on timer, accepted, labelled, attributed", + r and r["status"] == "accepted" and r["undoLabel"] == "Brokkr nibu/hands: createObject aaaaaaaa" + and r["requestedBy"] == "nibu/hands" and r["note"] == "queue test" and "QCube" in names(), r) + check("queue: intent removed from the queue after the drain", "blender/commands/aaaaaaaa-0001" not in pending(), list(pending())) + + +def q2(): + queue("aaaaaaaa-0001", action="createObject", objectType="MESH", name="QReuse", requestedBy="nibu/hands") + + +def q2_check(): + orig = receipt("aaaaaaaa-0001") + denial = receipt("aaaaaaaa-0001.denied") + R["receipts"]["q2_original"], R["receipts"]["q2_denial"] = orig, denial + check("queue: reused id leaves the original receipt untouched (write-once)", + orig["status"] == "accepted" and orig["undoLabel"] == S["q1_label"], orig) + check("queue: reused id reported under .denied, nothing created", + denial and denial["status"] == "denied" and "QReuse" not in names(), denial) + + +def q3(): + queue("aaaaaaaa-0003", action="createObject", objectType="MESH", name="QNoOwner") + + +def q3_check(): + r = receipt("aaaaaaaa-0003") + R["receipts"]["q3"] = r + check("queue: intent without requestedBy denied, scene unchanged", r["status"] == "denied" and "QNoOwner" not in names(), r) + + +def q4(): + queue("aaaaaaaa-0004", action="createObject", objectType="MESH", name="QOne", location=[0, 6, 0], requestedBy="nibu/hands") + queue("aaaaaaaa-0005", action="createObject", objectType="MESH", name="QTwo", location=[0, 8, 0], requestedBy="nibu/imagination") + + +def q4_undo_two(): + undo() + after_one = names() + undo() + after_two = names() + check("queue: two intents drained together are two undo steps, last first", + "QTwo" not in after_one and "QOne" in after_one and "QOne" not in after_two, [after_one, after_two]) + + +def q5_edit(): + cube = bpy.data.objects["Cube"] + bpy.context.view_layer.objects.active = cube + cube.select_set(True) + with win(): + bpy.ops.object.mode_set(mode="EDIT") + push("driver edit baseline") + queue("aaaaaaaa-0006", action="setWorld", color=[1, 0, 0], requestedBy="nibu/hands") + queue("aaaaaaaa-0007", action="exportGltf", filepath="edit.glb", requestedBy="nibu/hands") + queue("aaaaaaaa-0008", action="setObjectTransform", objectName="Cube", location=[0, 0, 9], requestedBy="nibu/hands") + + +def q5_check(): + rs = [receipt(k) for k in ("aaaaaaaa-0006", "aaaaaaaa-0007", "aaaaaaaa-0008")] + R["receipts"]["q5"] = rs + check("queue: in Edit Mode setWorld, exportGltf and an object write are all denied, her mode kept", + all(r["status"] == "denied" and r["undoLabel"] == "" for r in rs) and bpy.context.mode == "EDIT_MESH" + and not (SCRATCH / "out" / "edit.glb").exists(), [r["message"] for r in rs]) + + +def q5_exit(): + with win(): + bpy.ops.object.mode_set(mode="OBJECT") + check("queue: add-on drain reports no error", adapter.last_auto_drain_error == "", adapter.last_auto_drain_error) + + +steps = [ + once(q1), until(drained("aaaaaaaa-0001")), once(q1_check), + once(q2), until(lambda: receipt("aaaaaaaa-0001.denied")), once(q2_check), + once(q3), until(drained("aaaaaaaa-0003")), once(q3_check), + once(q4), until(drained("aaaaaaaa-0004", "aaaaaaaa-0005")), once(q4_undo_two), + once(q5_edit), until(drained("aaaaaaaa-0006", "aaaaaaaa-0007", "aaaaaaaa-0008")), once(q5_check), once(q5_exit), +] +i = 0 + + +def write(): + R["ok"] = bool(R["checks"]) and all(c["ok"] for c in R["checks"]) and not R.get("errors") + with open(OUT + ".result.json", "w") as f: + json.dump(R, f, indent=1, default=str) + + +def tick(): + global i + if i < len(steps): + try: + if steps[i](): + i += 1 + except Exception: + R.setdefault("errors", []).append({"step": i, "error": traceback.format_exc()}) + i = len(steps) + write() + return 0.5 + write() + bpy.ops.wm.quit_blender() + return None + + +bpy.app.timers.register(tick, first_interval=3.0) diff --git a/surfaces/blender/tests/live/agent_turn_queue.result.json b/surfaces/blender/tests/live/agent_turn_queue.result.json new file mode 100644 index 0000000..a040d56 --- /dev/null +++ b/surfaces/blender/tests/live/agent_turn_queue.result.json @@ -0,0 +1,196 @@ +{ + "blender": "5.3.0", + "checks": [ + { + "name": "queue: createObject drained by the add-on timer, accepted, labelled, attributed", + "ok": true, + "detail": { + "action": "createObject", + "commandId": "aaaaaaaa-0001", + "message": "Blender object created.", + "note": "queue test", + "objectName": "QCube", + "observedAt": "2026-11-27T18:07:31.682454+00:00", + "requestedBy": "nibu/hands", + "schema": "brokkr.blender.command_receipt.v0", + "status": "accepted", + "undoLabel": "Brokkr nibu/hands: createObject aaaaaaaa" + } + }, + { + "name": "queue: intent removed from the queue after the drain", + "ok": true, + "detail": [] + }, + { + "name": "queue: reused id leaves the original receipt untouched (write-once)", + "ok": true, + "detail": { + "action": "createObject", + "commandId": "aaaaaaaa-0001", + "message": "Blender object created.", + "note": "queue test", + "objectName": "QCube", + "observedAt": "2026-11-27T18:07:31.682454+00:00", + "requestedBy": "nibu/hands", + "schema": "brokkr.blender.command_receipt.v0", + "status": "accepted", + "undoLabel": "Brokkr nibu/hands: createObject aaaaaaaa" + } + }, + { + "name": "queue: reused id reported under .denied, nothing created", + "ok": true, + "detail": { + "action": "createObject", + "commandId": "aaaaaaaa-0001", + "message": "commandId 'aaaaaaaa-0001' was already receipted; ids are single-use.", + "note": "", + "objectName": "", + "observedAt": "2026-11-27T18:07:33.680885+00:00", + "requestedBy": "nibu/hands", + "schema": "brokkr.blender.command_receipt.v0", + "status": "denied", + "undoLabel": "" + } + }, + { + "name": "queue: intent without requestedBy denied, scene unchanged", + "ok": true, + "detail": { + "action": "createObject", + "commandId": "aaaaaaaa-0003", + "message": "Intent has no requestedBy of the form '/'.", + "note": "", + "objectName": "", + "observedAt": "2026-11-27T18:07:35.693748+00:00", + "requestedBy": "", + "schema": "brokkr.blender.command_receipt.v0", + "status": "denied", + "undoLabel": "" + } + }, + { + "name": "queue: two intents drained together are two undo steps, last first", + "ok": true, + "detail": [ + [ + "Camera", + "Cube", + "Light", + "QCube", + "QOne" + ], + [ + "Camera", + "Cube", + "Light", + "QCube" + ] + ] + }, + { + "name": "queue: in Edit Mode setWorld, exportGltf and an object write are all denied, her mode kept", + "ok": true, + "detail": [ + "Object 'Cube' is in Edit Mode: object-level intents are refused until she leaves it; nothing was changed.", + "Object 'Cube' is in Edit Mode: object-level intents are refused until she leaves it; nothing was changed.", + "Object 'Cube' is in Edit Mode: object-level intents are refused until she leaves it; nothing was changed." + ] + }, + { + "name": "queue: add-on drain reports no error", + "ok": true, + "detail": "" + } + ], + "receipts": { + "q1": { + "action": "createObject", + "commandId": "aaaaaaaa-0001", + "message": "Blender object created.", + "note": "queue test", + "objectName": "QCube", + "observedAt": "2026-11-27T18:07:31.682454+00:00", + "requestedBy": "nibu/hands", + "schema": "brokkr.blender.command_receipt.v0", + "status": "accepted", + "undoLabel": "Brokkr nibu/hands: createObject aaaaaaaa" + }, + "q2_original": { + "action": "createObject", + "commandId": "aaaaaaaa-0001", + "message": "Blender object created.", + "note": "queue test", + "objectName": "QCube", + "observedAt": "2026-11-27T18:07:31.682454+00:00", + "requestedBy": "nibu/hands", + "schema": "brokkr.blender.command_receipt.v0", + "status": "accepted", + "undoLabel": "Brokkr nibu/hands: createObject aaaaaaaa" + }, + "q2_denial": { + "action": "createObject", + "commandId": "aaaaaaaa-0001", + "message": "commandId 'aaaaaaaa-0001' was already receipted; ids are single-use.", + "note": "", + "objectName": "", + "observedAt": "2026-11-27T18:07:33.680885+00:00", + "requestedBy": "nibu/hands", + "schema": "brokkr.blender.command_receipt.v0", + "status": "denied", + "undoLabel": "" + }, + "q3": { + "action": "createObject", + "commandId": "aaaaaaaa-0003", + "message": "Intent has no requestedBy of the form '/'.", + "note": "", + "objectName": "", + "observedAt": "2026-11-27T18:07:35.693748+00:00", + "requestedBy": "", + "schema": "brokkr.blender.command_receipt.v0", + "status": "denied", + "undoLabel": "" + }, + "q5": [ + { + "action": "setWorld", + "commandId": "aaaaaaaa-0006", + "message": "Object 'Cube' is in Edit Mode: object-level intents are refused until she leaves it; nothing was changed.", + "note": "", + "objectName": "", + "observedAt": "2026-11-27T18:07:39.773004+00:00", + "requestedBy": "nibu/hands", + "schema": "brokkr.blender.command_receipt.v0", + "status": "denied", + "undoLabel": "" + }, + { + "action": "exportGltf", + "commandId": "aaaaaaaa-0007", + "message": "Object 'Cube' is in Edit Mode: object-level intents are refused until she leaves it; nothing was changed.", + "note": "", + "objectName": "", + "observedAt": "2026-11-27T18:07:39.867526+00:00", + "requestedBy": "nibu/hands", + "schema": "brokkr.blender.command_receipt.v0", + "status": "denied", + "undoLabel": "" + }, + { + "action": "setObjectTransform", + "commandId": "aaaaaaaa-0008", + "message": "Object 'Cube' is in Edit Mode: object-level intents are refused until she leaves it; nothing was changed.", + "note": "", + "objectName": "", + "observedAt": "2026-11-27T18:07:39.950112+00:00", + "requestedBy": "nibu/hands", + "schema": "brokkr.blender.command_receipt.v0", + "status": "denied", + "undoLabel": "" + } + ] + }, + "ok": true +} \ No newline at end of file diff --git a/surfaces/blender/tests/live/agent_turn_undo.py b/surfaces/blender/tests/live/agent_turn_undo.py index 75716ee..9a9dc1b 100644 --- a/surfaces/blender/tests/live/agent_turn_undo.py +++ b/surfaces/blender/tests/live/agent_turn_undo.py @@ -11,6 +11,7 @@ Exit status is not meaningful in a GUI session: read the "ok" fields of the resu import json import os import sys +import tempfile import traceback import types from pathlib import Path @@ -27,6 +28,8 @@ OUT = sys.argv[sys.argv.index("--") + 1] R = {"blender": bpy.app.version_string, "background": bpy.app.background, "checks": [], "steps": []} target = bt.BrokkrBlenderTarget(bpy) N = [0] +OUTDIR = tempfile.mkdtemp(prefix="brokkr-live2-") +target.configure_action_dirs("", OUTDIR) def check(name, ok, detail=None): @@ -136,6 +139,21 @@ def s_edit_agent(): and loc("Cube") == S["loc0"] and bpy.context.mode == "EDIT_MESH", R["editMode"]) +def s_edit_others(): + """Anything that writes scene state or changes her mode is refused in Edit Mode; renderStill does neither.""" + world0 = bpy.context.scene.world + rw = intent(action="setWorld", color=[1, 0, 0], strength=2.0) + rx = intent(action="exportGltf", filepath="edit.glb") + rr = intent(action="renderStill", outputPath="edit.png", engine="CYCLES", resolutionX=8, resolutionY=8) + R["editMode"].update(setWorld=rw["status"], exportGltf=rx["status"], renderStill=rr["status"], + mode_after_others=bpy.context.mode) + check("edit mode: setWorld and exportGltf denied, world untouched, no file written", + rw["status"] == "denied" and rx["status"] == "denied" and bpy.context.scene.world == world0 + and "edit.glb" not in os.listdir(OUTDIR), R["editMode"]) + check("edit mode: renderStill accepted, pushes nothing, her mode kept", + rr["status"] == "accepted" and rr["undoLabel"] == "" and bpy.context.mode == "EDIT_MESH", R["editMode"]) + + def s_edit_undo(): """One undo must revert her edit-mesh step: a step pushed by the refused intent would have taken it.""" undo() @@ -150,8 +168,22 @@ def s_exit(): bpy.ops.object.mode_set(mode="OBJECT") +def s_noop_setup(): + intent(action="createObject", objectType="MESH", name="AgentCube3", location=[0, -5, 0]) + rx = intent(action="exportGltf", filepath="object.glb") + rr = intent(action="renderStill", outputPath="object.png", engine="CYCLES", resolutionX=8, resolutionY=8) + check("exportGltf and renderStill accepted with no undoLabel", + rx["status"] == "accepted" and rr["status"] == "accepted" and rx["undoLabel"] == "" and rr["undoLabel"] == "", + [rx["message"], rr["message"]]) + + +def s_noop_undo(): + undo() + check("no-op actions pushed no step: one undo removes the preceding createObject", "AgentCube3" not in names(), names()) + + steps = [s_baseline, s_create, s_transform, s_undo_transform, s_undo_create, s_denied_setup, s_denied_undo, - s_edit_enter, s_edit_agent, s_edit_undo, s_exit] + s_edit_enter, s_edit_agent, s_edit_others, s_edit_undo, s_exit, s_noop_setup, s_noop_undo] i = 0 diff --git a/surfaces/blender/tests/live/agent_turn_undo.result.json b/surfaces/blender/tests/live/agent_turn_undo.result.json index 455335f..7e8e590 100644 --- a/surfaces/blender/tests/live/agent_turn_undo.result.json +++ b/surfaces/blender/tests/live/agent_turn_undo.result.json @@ -80,6 +80,76 @@ "receipt": "denied", "message": "Object 'Cube' is in Edit Mode: object-level intents are refused until she leaves it; nothing was changed.", "undoLabel": "", + "setWorld": "denied", + "exportGltf": "denied", + "renderStill": "accepted", + "mode_after_others": "EDIT_MESH", + "mode_after_undo": "EDIT_MESH", + "loc_after_undo": [ + 0.0, + 0.0, + 0.0 + ], + "z_before": 6.0, + "z_after_undo": 1.0 + } + }, + { + "name": "edit mode: setWorld and exportGltf denied, world untouched, no file written", + "ok": true, + "detail": { + "mode_before": "EDIT_MESH", + "loc_before": [ + 0.0, + 0.0, + 0.0 + ], + "mode_after_intent": "EDIT_MESH", + "loc_after_intent": [ + 0.0, + 0.0, + 0.0 + ], + "receipt": "denied", + "message": "Object 'Cube' is in Edit Mode: object-level intents are refused until she leaves it; nothing was changed.", + "undoLabel": "", + "setWorld": "denied", + "exportGltf": "denied", + "renderStill": "accepted", + "mode_after_others": "EDIT_MESH", + "mode_after_undo": "EDIT_MESH", + "loc_after_undo": [ + 0.0, + 0.0, + 0.0 + ], + "z_before": 6.0, + "z_after_undo": 1.0 + } + }, + { + "name": "edit mode: renderStill accepted, pushes nothing, her mode kept", + "ok": true, + "detail": { + "mode_before": "EDIT_MESH", + "loc_before": [ + 0.0, + 0.0, + 0.0 + ], + "mode_after_intent": "EDIT_MESH", + "loc_after_intent": [ + 0.0, + 0.0, + 0.0 + ], + "receipt": "denied", + "message": "Object 'Cube' is in Edit Mode: object-level intents are refused until she leaves it; nothing was changed.", + "undoLabel": "", + "setWorld": "denied", + "exportGltf": "denied", + "renderStill": "accepted", + "mode_after_others": "EDIT_MESH", "mode_after_undo": "EDIT_MESH", "loc_after_undo": [ 0.0, @@ -109,6 +179,10 @@ "receipt": "denied", "message": "Object 'Cube' is in Edit Mode: object-level intents are refused until she leaves it; nothing was changed.", "undoLabel": "", + "setWorld": "denied", + "exportGltf": "denied", + "renderStill": "accepted", + "mode_after_others": "EDIT_MESH", "mode_after_undo": "EDIT_MESH", "loc_after_undo": [ 0.0, @@ -118,6 +192,23 @@ "z_before": 6.0, "z_after_undo": 1.0 } + }, + { + "name": "exportGltf and renderStill accepted with no undoLabel", + "ok": true, + "detail": [ + "Exported glTF to C:\\Users\\Meta\\AppData\\Local\\Temp\\brokkr-live2-yk0g4dyg\\object.glb (3484 bytes).", + "Rendered still to object.png." + ] + }, + { + "name": "no-op actions pushed no step: one undo removes the preceding createObject", + "ok": true, + "detail": [ + "Camera", + "Cube", + "Light" + ] } ], "steps": [ @@ -150,6 +241,42 @@ "status": "denied", "undoLabel": "", "message": "Object 'Cube' is in Edit Mode: object-level intents are refused until she leaves it; nothing was changed." + }, + { + "intent": "setWorld", + "status": "denied", + "undoLabel": "", + "message": "Object 'Cube' is in Edit Mode: object-level intents are refused until she leaves it; nothing was changed." + }, + { + "intent": "exportGltf", + "status": "denied", + "undoLabel": "", + "message": "Object 'Cube' is in Edit Mode: object-level intents are refused until she leaves it; nothing was changed." + }, + { + "intent": "renderStill", + "status": "accepted", + "undoLabel": "", + "message": "Rendered still to edit.png." + }, + { + "intent": "createObject", + "status": "accepted", + "undoLabel": "Brokkr nibu/hands: createObject 00000009", + "message": "Blender object created." + }, + { + "intent": "exportGltf", + "status": "accepted", + "undoLabel": "", + "message": "Exported glTF to C:\\Users\\Meta\\AppData\\Local\\Temp\\brokkr-live2-yk0g4dyg\\object.glb (3484 bytes)." + }, + { + "intent": "renderStill", + "status": "accepted", + "undoLabel": "", + "message": "Rendered still to object.png." } ], "ok": true, @@ -169,6 +296,10 @@ "receipt": "denied", "message": "Object 'Cube' is in Edit Mode: object-level intents are refused until she leaves it; nothing was changed.", "undoLabel": "", + "setWorld": "denied", + "exportGltf": "denied", + "renderStill": "accepted", + "mode_after_others": "EDIT_MESH", "mode_after_undo": "EDIT_MESH", "loc_after_undo": [ 0.0, diff --git a/surfaces/blender/tests/test_agent_turn.py b/surfaces/blender/tests/test_agent_turn.py index db950a6..4874644 100644 --- a/surfaces/blender/tests/test_agent_turn.py +++ b/surfaces/blender/tests/test_agent_turn.py @@ -98,6 +98,102 @@ class AgentTurnTests(unittest.TestCase): SOURCE.read_text(encoding="utf-8")) self.assertEqual(bad, []) + # fix batch s1 + def test_world_and_export_are_refused_in_edit_mode_render_is_not(self): + self.bpy.mesh.mode = "EDIT" + for action, fields in (("setWorld", {}), ("exportGltf", {"filepath": "o.glb"})): + receipt = self.run_action(action=action, **fields) + self.assertEqual(receipt["status"], "denied", action) + self.assertIn("Edit Mode", receipt["message"]) + self.assertEqual(self.bpy.exported, []) + self.assertEqual(self.bpy.undo.pushes, []) + self.assertEqual(self.run_action(action="renderStill", outputPath="r.png", engine="CYCLES")["status"], "accepted") + + def test_export_and_render_push_no_undo_step(self): + self.assertEqual(self.run_action(action="exportGltf", filepath="o.glb")["status"], "accepted") + receipt = self.run_action(action="renderStill", outputPath="r.png", engine="CYCLES") + self.assertEqual(receipt["status"], "accepted") + self.assertEqual(receipt["undoLabel"], "") + self.assertEqual(self.bpy.undo.pushes, []) + + def test_returned_failed_receipt_pushes_nothing(self): + receipt = self.run_action(action="setObjectTransform", objectName="NoSuchObject", location=[1, 2, 3]) + self.assertEqual(receipt["status"], "failed") + self.assertEqual(self.bpy.undo.pushes, []) + + def test_denied_id_is_recorded_as_receipted(self): + self.bpy.mesh.mode = "EDIT" + self.assertEqual(self.run_action(action="createObject", objectType="EMPTY", commandId="denied-1")["status"], "denied") + self.bpy.mesh.mode = "OBJECT" + again = self.run_action(action="createObject", objectType="EMPTY", commandId="denied-1") + self.assertEqual(again["status"], "denied") + self.assertIn("single-use", again["message"]) + self.assertEqual(self.bpy.created, []) + + def test_undo_push_runs_under_the_first_window(self): + self.run_action(action="createObject", objectType="EMPTY") + self.assertEqual(self.bpy.undo.overrides, [{"window": self.bpy.undo.window}]) + + def test_push_failure_is_a_failed_receipt_and_never_reruns(self): + def broken(message): + raise RuntimeError("no undo stack") + self.bpy.ops.ed.undo_push = broken + receipt = self.run_action(action="createObject", objectType="EMPTY", commandId="push-fail-1") + self.assertEqual(receipt["status"], "failed") + self.assertIn("no undo stack", receipt["message"]) + self.assertEqual(receipt["undoLabel"], "") + again = self.run_action(action="createObject", objectType="EMPTY", commandId="push-fail-1") + self.assertEqual(again["status"], "denied") + self.assertEqual(len(self.bpy.created), 1) + + +class FakeNode: + """The node database drain_commands reads: intents, receipts, and what it puts and deletes.""" + def __init__(self, intents, receipts=()): + self.docs = {bt.COMMAND_INTENT_SCHEMA: dict(intents), bt.COMMAND_RECEIPT_SCHEMA: dict(receipts)} + self.puts = [] + self.deleted = [] + self.database = self + + def snapshot(self): + return {k: dict(v) for k, v in self.docs.items()} + + def put(self, document, key, value): + self.puts.append((key, value)) + + def delete(self, document, key): + self.deleted.append(key) + + +class DrainTests(unittest.TestCase): + setUp = ts.ActionTests.setUp + run_action = ts.ActionTests.run_action + + def drain(self, node): + docs = {"command_intent": "i", "command_receipt": "r"} + with unittest.mock.patch.object(self.target, "_open_node", return_value=(node, docs)): + return self.target.drain_commands(self.context, "cache", "src") + + def intent(self, cid, **fields): + return {"commandId": cid, "requestedBy": "nibu/hands", "action": "createObject", "objectType": "EMPTY", **fields} + + def test_drain_seeds_receipted_from_persisted_receipts(self): + old = {"blender/receipts/old-1": {"commandId": "old-1", "status": "accepted"}} + node = FakeNode({"blender/commands/old-1": self.intent("old-1")}, old) + receipts = self.drain(node) + self.assertEqual(receipts[0]["status"], "denied") + self.assertEqual(self.bpy.created, []) + + def test_reused_id_never_overwrites_the_original_receipt(self): + node = FakeNode({"blender/commands/a": self.intent("dup-1"), "blender/commands/b": self.intent("dup-1")}) + self.drain(node) + keys = [k for k, _ in node.puts] + self.assertEqual(keys.count("blender/receipts/dup-1"), 1) + self.assertEqual(dict(node.puts)["blender/receipts/dup-1"]["status"], "accepted") + denial = dict(node.puts)["blender/receipts/dup-1.denied"] + self.assertEqual(denial["status"], "denied") + self.assertEqual(sorted(node.deleted), ["blender/commands/a", "blender/commands/b"]) + if __name__ == "__main__": unittest.main() diff --git a/surfaces/blender/tests/test_scene_actions.py b/surfaces/blender/tests/test_scene_actions.py index c60b657..6c73c67 100644 --- a/surfaces/blender/tests/test_scene_actions.py +++ b/surfaces/blender/tests/test_scene_actions.py @@ -74,7 +74,10 @@ class FakeUndo: """What run_intent needs of bpy: a window to override and ed.undo_push, recorded.""" def __init__(self, bpy): self.pushes = [] - bpy.context = NS(window_manager=NS(windows=[object()]), temp_override=lambda **kw: contextlib.nullcontext()) + self.overrides = [] + self.window = object() + bpy.context = NS(window_manager=NS(windows=[self.window]), + temp_override=lambda **kw: (self.overrides.append(kw), contextlib.nullcontext())[1]) ops = getattr(bpy, "ops", None) or NS() ops.ed = NS(undo_push=lambda message: self.pushes.append(message)) bpy.ops = ops -- 2.47.3 From a6184b61582f5d1d94bdafe6b13fda15102d2d91 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 27 Nov 2026 19:34:27 +0100 Subject: [PATCH 08/13] Blender agent turn: Soul s2 fixes and a stock-Blender install commandId is validated (short key-safe string) before the reused check and any receipt key; a bad id is denied under a fresh key naming the queue key and leaves the queue. The add-on ships as an extension with a bundled msgpack wheel; _load_cultmesh names the module it lacks; NO_SCENE_CHANGE_ACTIONS is pinned; the queue harness runs in a stock Blender without PYLIBS. Co-Authored-By: Claude Sonnet 5.5 --- .../brokkr_bridge/blender_manifest.toml | 15 +++++ .../blender/brokkr_bridge/blender_target.py | 36 ++++++++--- .../msgpack-1.2.2-cp313-cp313-win_amd64.whl | Bin 0 -> 72206 bytes surfaces/blender/docs/install.md | 21 +++++++ .../blender/tests/live/agent_turn_queue.py | 54 +++++++++++++--- .../tests/live/agent_turn_queue.result.json | 59 ++++++++++++++---- surfaces/blender/tests/test_agent_turn.py | 47 ++++++++++++++ 7 files changed, 206 insertions(+), 26 deletions(-) create mode 100644 surfaces/blender/brokkr_bridge/blender_manifest.toml create mode 100644 surfaces/blender/brokkr_bridge/wheels/msgpack-1.2.2-cp313-cp313-win_amd64.whl diff --git a/surfaces/blender/brokkr_bridge/blender_manifest.toml b/surfaces/blender/brokkr_bridge/blender_manifest.toml new file mode 100644 index 0000000..ec5feed --- /dev/null +++ b/surfaces/blender/brokkr_bridge/blender_manifest.toml @@ -0,0 +1,15 @@ +schema_version = "1.0.0" +id = "brokkr_bridge" +version = "0.2.0" +name = "Brokkr Bridge" +tagline = "Brokkr command intents, receipts and snapshots over CultMesh" +maintainer = "GameCult " +type = "add-on" +blender_version_min = "5.3.0" +platforms = ["windows-x64"] +license = ["SPDX:GPL-3.0-or-later"] +# CultLib's cultnet-py and cultcache-py import msgpack; Blender's Python does not ship it. The wheel is +# the installed msgpack 1.2.2 CPython 3.13 Windows build (Blender 5.3 runs Python 3.13). The C extension +# matters: CultLib at baf4ecf7 fails on msgpack's pure-Python fallback (object_pairs_hook gets a generator). +# Linux and macOS wheels are not bundled yet. +wheels = ["./wheels/msgpack-1.2.2-cp313-cp313-win_amd64.whl"] diff --git a/surfaces/blender/brokkr_bridge/blender_target.py b/surfaces/blender/brokkr_bridge/blender_target.py index 2528bbc..3ed2dcf 100644 --- a/surfaces/blender/brokkr_bridge/blender_target.py +++ b/surfaces/blender/brokkr_bridge/blender_target.py @@ -59,6 +59,9 @@ NO_SCENE_CHANGE_ACTIONS = ("exportGltf", "renderStill") # Anything that writes scene state or changes her mode is refused; renderStill does neither. EDIT_MODE_SAFE_ACTIONS = ("renderStill",) REQUESTED_BY_SHAPE = re.compile(r"^[A-Za-z0-9._-]+/[A-Za-z0-9._-]+$") +# A commandId becomes part of a receipt key, so it is a short string of key-safe characters ('.' is left +# out: it separates the '.denied' suffix). +COMMAND_ID_SHAPE = re.compile(r"^[A-Za-z0-9_-]{1,128}$") NOTE_LIMIT = 200 EVALUATED_POSITION_CAP = 256 @@ -154,11 +157,18 @@ class BrokkrBlenderTarget: commands = snapshot.get(COMMAND_INTENT_SCHEMA, {}) receipts: list[dict[str, Any]] = [] self._receipted.update( - r.get("commandId", "") for r in snapshot.get(COMMAND_RECEIPT_SCHEMA, {}).values()) + r["commandId"] for r in snapshot.get(COMMAND_RECEIPT_SCHEMA, {}).values() + if isinstance(r.get("commandId"), str)) for command_key, command in sorted(commands.items()): - reused = command.get("commandId") in self._receipted + command_id = command.get("commandId") + valid = _valid_command_id(command_id) + reused = valid and command_id in self._receipted receipt = self.run_intent(context, command) + if not valid: + # No safe key exists for this id: the denial is receipted under a fresh key and names the + # queue key, so the intent leaves the queue and its sender can still find the refusal. + receipt["message"] += f" (queue key {command_key})" # Receipts are write-once: a reused id's denial goes under '.denied', never over the # original. The sender learns of it by reading that key (and the drain's returned list). self.publish_receipt(cache_path, cultlib_py_src, receipt, debug_mirror_root, @@ -521,8 +531,8 @@ class BrokkrBlenderTarget: requested_by = command.get("requestedBy") action = command.get("action", "") denial = "" - if not isinstance(command_id, str) or not command_id: - denial = "Intent has no commandId." + if not _valid_command_id(command_id): + denial = "Intent has no commandId of 1 to 128 letters, digits, '_' or '-'." elif command_id in self._receipted: denial = f"commandId {command_id!r} was already receipted; ids are single-use." elif not isinstance(requested_by, str) or not REQUESTED_BY_SHAPE.match(requested_by): @@ -533,7 +543,7 @@ class BrokkrBlenderTarget: denial = (f"Object {self._edit_mode_object()!r} is in Edit Mode: object-level intents are refused " "until she leaves it; nothing was changed.") if denial: - if isinstance(command_id, str) and command_id: + if _valid_command_id(command_id): self._receipted.add(command_id) return self._receipt(command, "denied", denial, "") @@ -1094,7 +1104,7 @@ class BrokkrBlenderTarget: def _receipt(self, command: dict[str, Any], status: str, message: str, object_name: str) -> dict[str, Any]: return { "schema": COMMAND_RECEIPT_SCHEMA, - "commandId": command.get("commandId") or uuid.uuid4().hex, + "commandId": command["commandId"] if _valid_command_id(command.get("commandId")) else uuid.uuid4().hex, "action": command.get("action", ""), "status": status, "message": message, @@ -1222,9 +1232,15 @@ def _load_cultmesh(cultlib_py_src: str) -> tuple[Any, Any]: import cultmesh_py # type: ignore import cultcache_py # type: ignore except ModuleNotFoundError as exc: + own = {name.replace("-", "_") for name in CULTLIB_PY_PACKAGES} + if exc.name in own: + raise RuntimeError( + "Brokkr Blender target requires CultLib's Python packages. Set CultLib Python Source " + "to the CultLib packages directory or install cultcache-py, cultnet-py and cultmesh-py into Blender's Python." + ) from exc raise RuntimeError( - "Brokkr Blender target requires CultLib's Python packages. Set CultLib Python Source " - "to the CultLib packages directory or install cultcache-py, cultnet-py and cultmesh-py into Blender's Python." + f"A CultLib Python package needs the module {exc.name!r}, which Blender's Python does not have. " + "Install the add-on as an extension (it bundles msgpack) or install that module into Blender's Python." ) from exc if not hasattr(cultcache_py, "convert"): raise RuntimeError( @@ -1255,6 +1271,10 @@ def _to_list(value: Any) -> list[float]: return [float(item) for item in value] +def _valid_command_id(value: Any) -> bool: + return isinstance(value, str) and COMMAND_ID_SHAPE.match(value) is not None + + def _vector(value: Any, size: int, fallback: Any) -> tuple[float, ...]: if value is None: return tuple(float(item) for item in fallback) diff --git a/surfaces/blender/brokkr_bridge/wheels/msgpack-1.2.2-cp313-cp313-win_amd64.whl b/surfaces/blender/brokkr_bridge/wheels/msgpack-1.2.2-cp313-cp313-win_amd64.whl new file mode 100644 index 0000000000000000000000000000000000000000..83a8682553e2b936e0c3cb72ecf267cd6ec8b371 GIT binary patch literal 72206 zcmY&;Q;aT58{|8-ZCht->x^yNwmoykwr$(CZQHi?+hi~Hzvxb<(|OWKRq~)pUJ3*h z6#xK0{k-&0blszJo zLxj-!IE-womWg+OYMwKHl6azUFXfs1yV%AHB%T_PGBCc;yraN@8< zK~4VkOyFTt@?>Xl%%8t;5r?*^LGa0m$&g`U zX#ZoLXWtugLeO>$hHG2L4V15#eLV1OaE5dg&)do|Jx(CA60`ekarMt@+2LXAhr_5I z;^!oKYt~ zAn(#=vy(yjH5`js%?BX=KjaufT=r=Fj~o{Nkpu1jBZrB*k%_&tg`KU_fAmOJlCdlN zfAm;~iEnrZiuWv+EYf95&UnIZch|0Bbv=qLdVl2}0m4;{cjffI@A7zb_hpITgn;ld zoWA|&>`zP;Q#-V5r-I3|s#oV>4x4+jH=yNMB--klVrCQSVs-Yp1>J!LdxS)BPz1RI|D!vnf8V zfh%&yM%9kWMI1~JPkX`(IOD{b4o7gBF0%tn=XStP!k<>%GbYU2_!G0O5a;mVfl0t%d*qmaqT-`2RuL`9Fw@HEirQ#gKn&`+f~%`_Ym} z>KlyOk`XZ=IL=u`FH1O1H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S87TqOclKee~6EDTT%e=4Xp#ygp1BoeTssEZ8sdXSaJ0cn5=fb#PT;zI7 z&n)oRa0}9SudRmMUkUgXY=VgwLynM3CJ`L~AVDsfzfu^o?*BtiT$YwjZcaXymYg0h zeg}LaoPE)OZ0v*tJo>9Q@)?FgjnpguiCuBo1=!em_&B+{dH)xL_F33OJr)2kLjeE~ z{0)JHg#JSK{FlDNaNoTWDgZz@>Ua6q@qYESw{mf@M#j+o3*ag`s/surfaces/blender/brokkr_brid The command prints the record count and leaves the source unwritten. Records a new daemon already appended (MessagePack) are carried into the new file. +### msgpack for a stock Blender + +CultLib's `cultnet-py` and `cultcache-py` import `msgpack`, and Blender's Python does +not ship it. Install Brokkr as an extension so Blender installs it for you: +`surfaces/blender/brokkr_bridge/blender_manifest.toml` lists the bundled wheel +`wheels/msgpack-1.2.2-cp313-cp313-win_amd64.whl`, which Blender unpacks into the extension's own +site-packages when the extension is enabled. Build and install it: + +```text +blender --command extension build --source-dir surfaces/blender/brokkr_bridge --output-dir +blender --command extension install-file --repo user_default --enable /brokkr_bridge-0.2.0.zip +``` + +The bundled wheel is msgpack 1.2.2 for CPython 3.13 on Windows x64 (Blender 5.3's Python), +repacked from the installed package with its Apache-2.0 licence; the extension is therefore +declared `windows-x64`, Blender 5.3 or newer. The C extension matters: CultLib at `baf4ecf7` +fails on msgpack's pure-Python fallback. Linux and macOS wheels are not bundled yet: there, +or in a plain add-on directory install, put `msgpack` into Blender's Python yourself. A +CultLib package missing a module is reported by that module's name, not as a missing +CultLib package. + The default node cache is: ```text diff --git a/surfaces/blender/tests/live/agent_turn_queue.py b/surfaces/blender/tests/live/agent_turn_queue.py index e44669a..18fc00a 100644 --- a/surfaces/blender/tests/live/agent_turn_queue.py +++ b/surfaces/blender/tests/live/agent_turn_queue.py @@ -3,13 +3,17 @@ are drained by the add-on's own 1 s timer as one undo step each, with write-once BROKKR_USER_SCRIPTS= (also BLENDER_USER_SCRIPTS) BROKKR_SCRATCH= - BROKKR_PYLIBS= + BROKKR_ADDON_MODULE= + BROKKR_CULTLIB= + BROKKR_PYLIBS= blender --factory-startup --python agent_turn_queue.py -- Intents are put into the node database as brokkr-ctl does (no debug-mirror files). Writes .result.json, then quits Blender. Undo is read only here, by this driver. """ +import importlib import json import os import sys @@ -23,19 +27,28 @@ if os.environ.get("BROKKR_PYLIBS"): SCRATCH = Path(os.environ["BROKKR_SCRATCH"]).resolve() SCRATCH.mkdir(parents=True, exist_ok=True) OUT = sys.argv[sys.argv.index("--") + 1] -R = {"blender": bpy.app.version_string, "checks": [], "receipts": {}} +R = {"blender": bpy.app.version_string, "module": os.environ.get("BROKKR_ADDON_MODULE", "brokkr_bridge"), + "pylibs": bool(os.environ.get("BROKKR_PYLIBS")), "checks": [], "receipts": {}} -bpy.ops.preferences.addon_enable(module="brokkr_bridge") -import brokkr_bridge as addon # noqa: E402 -from brokkr_bridge import blender_target as bt # noqa: E402 +MODULE = os.environ.get("BROKKR_ADDON_MODULE", "brokkr_bridge") +bpy.ops.preferences.addon_enable(module=MODULE) +addon = importlib.import_module(MODULE) +bt = importlib.import_module(MODULE + ".blender_target") -prefs = bpy.context.preferences.addons["brokkr_bridge"].preferences +try: + import msgpack + R["msgpack"] = msgpack.__file__ +except ImportError: + R["msgpack"] = None +prefs = bpy.context.preferences.addons[MODULE].preferences CACHE = str(SCRATCH / "queue.ccmp") prefs.cultmesh_cache_path = CACHE prefs.debug_mirror_root = "" # the debug-mirror door is not used here prefs.output_dir = str(SCRATCH / "out") prefs.import_dir = "" prefs.auto_drain_commands = True +if os.environ.get("BROKKR_CULTLIB"): + prefs.cultlib_py_src = os.environ["BROKKR_CULTLIB"] (SCRATCH / "out").mkdir(exist_ok=True) adapter = addon.target() @@ -73,6 +86,11 @@ def receipt(key): return n.database.snapshot().get(bt.COMMAND_RECEIPT_SCHEMA, {}).get(f"blender/receipts/{key}") +def all_receipts(): + n, _ = node() + return n.database.snapshot().get(bt.COMMAND_RECEIPT_SCHEMA, {}) + + def pending(): n, _ = node() return n.database.snapshot().get(bt.COMMAND_INTENT_SCHEMA, {}) @@ -190,11 +208,33 @@ def q5_exit(): check("queue: add-on drain reports no error", adapter.last_auto_drain_error == "", adapter.last_auto_drain_error) +def q6(): + queue("bad-list", action="createObject", objectType="MESH", name="QBadList", requestedBy="nibu/hands") + queue("bad-int", action="createObject", objectType="MESH", name="QBadInt", requestedBy="nibu/hands") + n, docs = node() + for key in ("bad-list", "bad-int"): # overwrite the id with a non-string, as a hand-written put could + doc = dict(n.database.snapshot()[bt.COMMAND_INTENT_SCHEMA][f"blender/commands/{key}"]) + doc["commandId"] = ["x"] if key == "bad-list" else 7 + n.database.put(docs["command_intent"], f"blender/commands/{key}", doc) + queue("zzzzzzzz-good", action="createObject", objectType="MESH", name="QAfterBad", requestedBy="nibu/hands") + + +def q6_check(): + denials = [r for k, r in all_receipts().items() if "queue key blender/commands/bad-" in r.get("message", "")] + R["receipts"]["q6"] = denials + check("queue: a list id and an int id are denied under fresh keys, removed from the queue, drain not wedged", + len(denials) == 2 and all(r["status"] == "denied" and isinstance(r["commandId"], str) for r in denials) + and not pending() and "QBadList" not in names() and "QBadInt" not in names() + and receipt("zzzzzzzz-good")["status"] == "accepted" and "QAfterBad" in names() + and adapter.last_auto_drain_error == "", [adapter.last_auto_drain_error, list(pending())]) + + steps = [ once(q1), until(drained("aaaaaaaa-0001")), once(q1_check), once(q2), until(lambda: receipt("aaaaaaaa-0001.denied")), once(q2_check), once(q3), until(drained("aaaaaaaa-0003")), once(q3_check), once(q4), until(drained("aaaaaaaa-0004", "aaaaaaaa-0005")), once(q4_undo_two), + once(q6), until(drained("zzzzzzzz-good")), once(q6_check), once(q5_edit), until(drained("aaaaaaaa-0006", "aaaaaaaa-0007", "aaaaaaaa-0008")), once(q5_check), once(q5_exit), ] i = 0 diff --git a/surfaces/blender/tests/live/agent_turn_queue.result.json b/surfaces/blender/tests/live/agent_turn_queue.result.json index a040d56..cbd7ce5 100644 --- a/surfaces/blender/tests/live/agent_turn_queue.result.json +++ b/surfaces/blender/tests/live/agent_turn_queue.result.json @@ -1,5 +1,7 @@ { "blender": "5.3.0", + "module": "bl_ext.user_default.brokkr_bridge", + "pylibs": false, "checks": [ { "name": "queue: createObject drained by the add-on timer, accepted, labelled, attributed", @@ -10,7 +12,7 @@ "message": "Blender object created.", "note": "queue test", "objectName": "QCube", - "observedAt": "2026-11-27T18:07:31.682454+00:00", + "observedAt": "2026-11-27T18:33:33.859109+00:00", "requestedBy": "nibu/hands", "schema": "brokkr.blender.command_receipt.v0", "status": "accepted", @@ -31,7 +33,7 @@ "message": "Blender object created.", "note": "queue test", "objectName": "QCube", - "observedAt": "2026-11-27T18:07:31.682454+00:00", + "observedAt": "2026-11-27T18:33:33.859109+00:00", "requestedBy": "nibu/hands", "schema": "brokkr.blender.command_receipt.v0", "status": "accepted", @@ -47,7 +49,7 @@ "message": "commandId 'aaaaaaaa-0001' was already receipted; ids are single-use.", "note": "", "objectName": "", - "observedAt": "2026-11-27T18:07:33.680885+00:00", + "observedAt": "2026-11-27T18:33:35.854629+00:00", "requestedBy": "nibu/hands", "schema": "brokkr.blender.command_receipt.v0", "status": "denied", @@ -63,7 +65,7 @@ "message": "Intent has no requestedBy of the form '/'.", "note": "", "objectName": "", - "observedAt": "2026-11-27T18:07:35.693748+00:00", + "observedAt": "2026-11-27T18:33:37.862020+00:00", "requestedBy": "", "schema": "brokkr.blender.command_receipt.v0", "status": "denied", @@ -89,6 +91,14 @@ ] ] }, + { + "name": "queue: a list id and an int id are denied under fresh keys, removed from the queue, drain not wedged", + "ok": true, + "detail": [ + "", + [] + ] + }, { "name": "queue: in Edit Mode setWorld, exportGltf and an object write are all denied, her mode kept", "ok": true, @@ -111,7 +121,7 @@ "message": "Blender object created.", "note": "queue test", "objectName": "QCube", - "observedAt": "2026-11-27T18:07:31.682454+00:00", + "observedAt": "2026-11-27T18:33:33.859109+00:00", "requestedBy": "nibu/hands", "schema": "brokkr.blender.command_receipt.v0", "status": "accepted", @@ -123,7 +133,7 @@ "message": "Blender object created.", "note": "queue test", "objectName": "QCube", - "observedAt": "2026-11-27T18:07:31.682454+00:00", + "observedAt": "2026-11-27T18:33:33.859109+00:00", "requestedBy": "nibu/hands", "schema": "brokkr.blender.command_receipt.v0", "status": "accepted", @@ -135,7 +145,7 @@ "message": "commandId 'aaaaaaaa-0001' was already receipted; ids are single-use.", "note": "", "objectName": "", - "observedAt": "2026-11-27T18:07:33.680885+00:00", + "observedAt": "2026-11-27T18:33:35.854629+00:00", "requestedBy": "nibu/hands", "schema": "brokkr.blender.command_receipt.v0", "status": "denied", @@ -147,12 +157,38 @@ "message": "Intent has no requestedBy of the form '/'.", "note": "", "objectName": "", - "observedAt": "2026-11-27T18:07:35.693748+00:00", + "observedAt": "2026-11-27T18:33:37.862020+00:00", "requestedBy": "", "schema": "brokkr.blender.command_receipt.v0", "status": "denied", "undoLabel": "" }, + "q6": [ + { + "action": "createObject", + "commandId": "8cdf6298074845bfa652d7136ec176f0", + "message": "Intent has no commandId of 1 to 128 letters, digits, '_' or '-'. (queue key blender/commands/bad-int)", + "note": "", + "objectName": "", + "observedAt": "2026-11-27T18:33:41.872393+00:00", + "requestedBy": "nibu/hands", + "schema": "brokkr.blender.command_receipt.v0", + "status": "denied", + "undoLabel": "" + }, + { + "action": "createObject", + "commandId": "cfdfef85da3a4c0398901d7ffef109af", + "message": "Intent has no commandId of 1 to 128 letters, digits, '_' or '-'. (queue key blender/commands/bad-list)", + "note": "", + "objectName": "", + "observedAt": "2026-11-27T18:33:41.884756+00:00", + "requestedBy": "nibu/hands", + "schema": "brokkr.blender.command_receipt.v0", + "status": "denied", + "undoLabel": "" + } + ], "q5": [ { "action": "setWorld", @@ -160,7 +196,7 @@ "message": "Object 'Cube' is in Edit Mode: object-level intents are refused until she leaves it; nothing was changed.", "note": "", "objectName": "", - "observedAt": "2026-11-27T18:07:39.773004+00:00", + "observedAt": "2026-11-27T18:33:43.881906+00:00", "requestedBy": "nibu/hands", "schema": "brokkr.blender.command_receipt.v0", "status": "denied", @@ -172,7 +208,7 @@ "message": "Object 'Cube' is in Edit Mode: object-level intents are refused until she leaves it; nothing was changed.", "note": "", "objectName": "", - "observedAt": "2026-11-27T18:07:39.867526+00:00", + "observedAt": "2026-11-27T18:33:43.894611+00:00", "requestedBy": "nibu/hands", "schema": "brokkr.blender.command_receipt.v0", "status": "denied", @@ -184,7 +220,7 @@ "message": "Object 'Cube' is in Edit Mode: object-level intents are refused until she leaves it; nothing was changed.", "note": "", "objectName": "", - "observedAt": "2026-11-27T18:07:39.950112+00:00", + "observedAt": "2026-11-27T18:33:43.916685+00:00", "requestedBy": "nibu/hands", "schema": "brokkr.blender.command_receipt.v0", "status": "denied", @@ -192,5 +228,6 @@ } ] }, + "msgpack": "F:\\aeth-wt\\brokkr-live-2.res\\extensions\\.local\\lib\\python3.13\\site-packages\\msgpack\\__init__.py", "ok": true } \ No newline at end of file diff --git a/surfaces/blender/tests/test_agent_turn.py b/surfaces/blender/tests/test_agent_turn.py index 4874644..69e83fc 100644 --- a/surfaces/blender/tests/test_agent_turn.py +++ b/surfaces/blender/tests/test_agent_turn.py @@ -2,6 +2,8 @@ from __future__ import annotations import re +import sys +import tempfile import unittest import unittest.mock from pathlib import Path @@ -146,6 +148,36 @@ class AgentTurnTests(unittest.TestCase): self.assertEqual(again["status"], "denied") self.assertEqual(len(self.bpy.created), 1) + # fix batch s2 + def test_no_scene_change_set_is_exactly_export_and_render(self): + self.assertEqual(bt.NO_SCENE_CHANGE_ACTIONS, ("exportGltf", "renderStill")) + receipt = self.run_action(action="setWorld", color=[0.1, 0.2, 0.3]) + self.assertEqual(receipt["status"], "accepted") + self.assertEqual(len(self.bpy.undo.pushes), 1) + + def test_malformed_command_ids_are_denied_without_raising(self): + for bad in (["x"], 7, 1.5, {"a": 1}, "", "a/b", "x.denied", "has space", "a" * 200, None, True): + receipt = self.run_action(action="createObject", objectType="EMPTY", commandId=bad) + self.assertEqual(receipt["status"], "denied", repr(bad)) + self.assertIsInstance(receipt["commandId"], str) + self.assertRegex(receipt["commandId"], bt.COMMAND_ID_SHAPE.pattern, repr(bad)) + self.assertEqual(self.bpy.created, []) + self.assertEqual(self.bpy.undo.pushes, []) + + def test_load_cultmesh_names_the_missing_module(self): + root = Path(tempfile.mkdtemp()) + self.addCleanup(lambda: __import__("shutil").rmtree(root, ignore_errors=True)) + src = root / "cultmesh-py" / "src" / "cultmesh_py" + src.mkdir(parents=True) + (src / "__init__.py").write_text("import brokkr_no_such_dependency_xyz") + saved = {k: sys.modules.pop(k) for k in ("cultmesh_py", "cultcache_py") if k in sys.modules} + saved_path = list(sys.path) + self.addCleanup(lambda: (sys.modules.update(saved), sys.path[:] == saved_path or sys.path.__setitem__(slice(None), saved_path))) + with self.assertRaises(RuntimeError) as caught: + bt._load_cultmesh(str(root)) + self.assertIn("brokkr_no_such_dependency_xyz", str(caught.exception)) + self.assertNotIn("requires CultLib's Python packages", str(caught.exception)) + class FakeNode: """The node database drain_commands reads: intents, receipts, and what it puts and deletes.""" @@ -177,6 +209,21 @@ class DrainTests(unittest.TestCase): def intent(self, cid, **fields): return {"commandId": cid, "requestedBy": "nibu/hands", "action": "createObject", "objectType": "EMPTY", **fields} + def test_malformed_ids_in_the_queue_never_wedge_the_drain(self): + node = FakeNode({ + "blender/commands/a-list": self.intent(["x"]), + "blender/commands/b-int": self.intent(7), + "blender/commands/c-good": self.intent("good-1"), + }) + receipts = self.drain(node) # must not raise + self.assertEqual(sorted(node.deleted), sorted(node.docs[bt.COMMAND_INTENT_SCHEMA])) + self.assertEqual([r["status"] for r in receipts], ["denied", "denied", "accepted"]) + keys = [k for k, _ in node.puts] + self.assertTrue(all(isinstance(k, str) and "[" not in k for k in keys), keys) + self.assertIn("blender/receipts/good-1", keys) + bad = [v for k, v in node.puts if k != "blender/receipts/good-1"] + self.assertTrue(all("blender/commands/" in v["message"] for v in bad), [v["message"] for v in bad]) + def test_drain_seeds_receipted_from_persisted_receipts(self): old = {"blender/receipts/old-1": {"commandId": "old-1", "status": "accepted"}} node = FakeNode({"blender/commands/old-1": self.intent("old-1")}, old) -- 2.47.3 From 57ca88ed381aa19a495564acd537a5fc5e32102b Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 27 Nov 2026 20:02:50 +0100 Subject: [PATCH 09/13] Blender agent turn: live harness results rerun on main a371056f (CultLib baf4ecf7 pins) Co-Authored-By: Claude Sonnet 5.5 --- .../tests/live/agent_turn_queue.result.json | 208 +++++++++--------- .../tests/live/agent_turn_undo.result.json | 4 +- 2 files changed, 106 insertions(+), 106 deletions(-) diff --git a/surfaces/blender/tests/live/agent_turn_queue.result.json b/surfaces/blender/tests/live/agent_turn_queue.result.json index cbd7ce5..9d8a289 100644 --- a/surfaces/blender/tests/live/agent_turn_queue.result.json +++ b/surfaces/blender/tests/live/agent_turn_queue.result.json @@ -7,16 +7,16 @@ "name": "queue: createObject drained by the add-on timer, accepted, labelled, attributed", "ok": true, "detail": { - "action": "createObject", - "commandId": "aaaaaaaa-0001", - "message": "Blender object created.", - "note": "queue test", - "objectName": "QCube", - "observedAt": "2026-11-27T18:33:33.859109+00:00", - "requestedBy": "nibu/hands", "schema": "brokkr.blender.command_receipt.v0", + "commandId": "aaaaaaaa-0001", + "action": "createObject", "status": "accepted", - "undoLabel": "Brokkr nibu/hands: createObject aaaaaaaa" + "message": "Blender object created.", + "objectName": "QCube", + "requestedBy": "nibu/hands", + "note": "queue test", + "undoLabel": "Brokkr nibu/hands: createObject aaaaaaaa", + "observedAt": "2026-11-27T19:01:35.205337+00:00" } }, { @@ -28,48 +28,48 @@ "name": "queue: reused id leaves the original receipt untouched (write-once)", "ok": true, "detail": { - "action": "createObject", - "commandId": "aaaaaaaa-0001", - "message": "Blender object created.", - "note": "queue test", - "objectName": "QCube", - "observedAt": "2026-11-27T18:33:33.859109+00:00", - "requestedBy": "nibu/hands", "schema": "brokkr.blender.command_receipt.v0", + "commandId": "aaaaaaaa-0001", + "action": "createObject", "status": "accepted", - "undoLabel": "Brokkr nibu/hands: createObject aaaaaaaa" + "message": "Blender object created.", + "objectName": "QCube", + "requestedBy": "nibu/hands", + "note": "queue test", + "undoLabel": "Brokkr nibu/hands: createObject aaaaaaaa", + "observedAt": "2026-11-27T19:01:35.205337+00:00" } }, { "name": "queue: reused id reported under .denied, nothing created", "ok": true, "detail": { - "action": "createObject", - "commandId": "aaaaaaaa-0001", - "message": "commandId 'aaaaaaaa-0001' was already receipted; ids are single-use.", - "note": "", - "objectName": "", - "observedAt": "2026-11-27T18:33:35.854629+00:00", - "requestedBy": "nibu/hands", "schema": "brokkr.blender.command_receipt.v0", + "commandId": "aaaaaaaa-0001", + "action": "createObject", "status": "denied", - "undoLabel": "" + "message": "commandId 'aaaaaaaa-0001' was already receipted; ids are single-use.", + "objectName": "", + "requestedBy": "nibu/hands", + "note": "", + "undoLabel": "", + "observedAt": "2026-11-27T19:01:37.202231+00:00" } }, { "name": "queue: intent without requestedBy denied, scene unchanged", "ok": true, "detail": { - "action": "createObject", - "commandId": "aaaaaaaa-0003", - "message": "Intent has no requestedBy of the form '/'.", - "note": "", - "objectName": "", - "observedAt": "2026-11-27T18:33:37.862020+00:00", - "requestedBy": "", "schema": "brokkr.blender.command_receipt.v0", + "commandId": "aaaaaaaa-0003", + "action": "createObject", "status": "denied", - "undoLabel": "" + "message": "Intent has no requestedBy of the form '/'.", + "objectName": "", + "requestedBy": "", + "note": "", + "undoLabel": "", + "observedAt": "2026-11-27T19:01:39.207926+00:00" } }, { @@ -116,115 +116,115 @@ ], "receipts": { "q1": { - "action": "createObject", - "commandId": "aaaaaaaa-0001", - "message": "Blender object created.", - "note": "queue test", - "objectName": "QCube", - "observedAt": "2026-11-27T18:33:33.859109+00:00", - "requestedBy": "nibu/hands", "schema": "brokkr.blender.command_receipt.v0", + "commandId": "aaaaaaaa-0001", + "action": "createObject", "status": "accepted", - "undoLabel": "Brokkr nibu/hands: createObject aaaaaaaa" + "message": "Blender object created.", + "objectName": "QCube", + "requestedBy": "nibu/hands", + "note": "queue test", + "undoLabel": "Brokkr nibu/hands: createObject aaaaaaaa", + "observedAt": "2026-11-27T19:01:35.205337+00:00" }, "q2_original": { - "action": "createObject", - "commandId": "aaaaaaaa-0001", - "message": "Blender object created.", - "note": "queue test", - "objectName": "QCube", - "observedAt": "2026-11-27T18:33:33.859109+00:00", - "requestedBy": "nibu/hands", "schema": "brokkr.blender.command_receipt.v0", + "commandId": "aaaaaaaa-0001", + "action": "createObject", "status": "accepted", - "undoLabel": "Brokkr nibu/hands: createObject aaaaaaaa" + "message": "Blender object created.", + "objectName": "QCube", + "requestedBy": "nibu/hands", + "note": "queue test", + "undoLabel": "Brokkr nibu/hands: createObject aaaaaaaa", + "observedAt": "2026-11-27T19:01:35.205337+00:00" }, "q2_denial": { - "action": "createObject", - "commandId": "aaaaaaaa-0001", - "message": "commandId 'aaaaaaaa-0001' was already receipted; ids are single-use.", - "note": "", - "objectName": "", - "observedAt": "2026-11-27T18:33:35.854629+00:00", - "requestedBy": "nibu/hands", "schema": "brokkr.blender.command_receipt.v0", + "commandId": "aaaaaaaa-0001", + "action": "createObject", "status": "denied", - "undoLabel": "" + "message": "commandId 'aaaaaaaa-0001' was already receipted; ids are single-use.", + "objectName": "", + "requestedBy": "nibu/hands", + "note": "", + "undoLabel": "", + "observedAt": "2026-11-27T19:01:37.202231+00:00" }, "q3": { - "action": "createObject", - "commandId": "aaaaaaaa-0003", - "message": "Intent has no requestedBy of the form '/'.", - "note": "", - "objectName": "", - "observedAt": "2026-11-27T18:33:37.862020+00:00", - "requestedBy": "", "schema": "brokkr.blender.command_receipt.v0", + "commandId": "aaaaaaaa-0003", + "action": "createObject", "status": "denied", - "undoLabel": "" + "message": "Intent has no requestedBy of the form '/'.", + "objectName": "", + "requestedBy": "", + "note": "", + "undoLabel": "", + "observedAt": "2026-11-27T19:01:39.207926+00:00" }, "q6": [ { - "action": "createObject", - "commandId": "8cdf6298074845bfa652d7136ec176f0", - "message": "Intent has no commandId of 1 to 128 letters, digits, '_' or '-'. (queue key blender/commands/bad-int)", - "note": "", - "objectName": "", - "observedAt": "2026-11-27T18:33:41.872393+00:00", - "requestedBy": "nibu/hands", "schema": "brokkr.blender.command_receipt.v0", + "commandId": "ae0a53d8d0584e54b1ce518cf7e8cf9d", + "action": "createObject", "status": "denied", - "undoLabel": "" + "message": "Intent has no commandId of 1 to 128 letters, digits, '_' or '-'. (queue key blender/commands/bad-int)", + "objectName": "", + "requestedBy": "nibu/hands", + "note": "", + "undoLabel": "", + "observedAt": "2026-11-27T19:01:43.220315+00:00" }, { - "action": "createObject", - "commandId": "cfdfef85da3a4c0398901d7ffef109af", - "message": "Intent has no commandId of 1 to 128 letters, digits, '_' or '-'. (queue key blender/commands/bad-list)", - "note": "", - "objectName": "", - "observedAt": "2026-11-27T18:33:41.884756+00:00", - "requestedBy": "nibu/hands", "schema": "brokkr.blender.command_receipt.v0", + "commandId": "f5ce147da5e0466ab0771ac13135f4be", + "action": "createObject", "status": "denied", - "undoLabel": "" + "message": "Intent has no commandId of 1 to 128 letters, digits, '_' or '-'. (queue key blender/commands/bad-list)", + "objectName": "", + "requestedBy": "nibu/hands", + "note": "", + "undoLabel": "", + "observedAt": "2026-11-27T19:01:43.242934+00:00" } ], "q5": [ { - "action": "setWorld", + "schema": "brokkr.blender.command_receipt.v0", "commandId": "aaaaaaaa-0006", - "message": "Object 'Cube' is in Edit Mode: object-level intents are refused until she leaves it; nothing was changed.", - "note": "", - "objectName": "", - "observedAt": "2026-11-27T18:33:43.881906+00:00", - "requestedBy": "nibu/hands", - "schema": "brokkr.blender.command_receipt.v0", + "action": "setWorld", "status": "denied", - "undoLabel": "" + "message": "Object 'Cube' is in Edit Mode: object-level intents are refused until she leaves it; nothing was changed.", + "objectName": "", + "requestedBy": "nibu/hands", + "note": "", + "undoLabel": "", + "observedAt": "2026-11-27T19:01:45.227825+00:00" }, { - "action": "exportGltf", + "schema": "brokkr.blender.command_receipt.v0", "commandId": "aaaaaaaa-0007", - "message": "Object 'Cube' is in Edit Mode: object-level intents are refused until she leaves it; nothing was changed.", - "note": "", - "objectName": "", - "observedAt": "2026-11-27T18:33:43.894611+00:00", - "requestedBy": "nibu/hands", - "schema": "brokkr.blender.command_receipt.v0", + "action": "exportGltf", "status": "denied", - "undoLabel": "" + "message": "Object 'Cube' is in Edit Mode: object-level intents are refused until she leaves it; nothing was changed.", + "objectName": "", + "requestedBy": "nibu/hands", + "note": "", + "undoLabel": "", + "observedAt": "2026-11-27T19:01:45.250025+00:00" }, { - "action": "setObjectTransform", - "commandId": "aaaaaaaa-0008", - "message": "Object 'Cube' is in Edit Mode: object-level intents are refused until she leaves it; nothing was changed.", - "note": "", - "objectName": "", - "observedAt": "2026-11-27T18:33:43.916685+00:00", - "requestedBy": "nibu/hands", "schema": "brokkr.blender.command_receipt.v0", + "commandId": "aaaaaaaa-0008", + "action": "setObjectTransform", "status": "denied", - "undoLabel": "" + "message": "Object 'Cube' is in Edit Mode: object-level intents are refused until she leaves it; nothing was changed.", + "objectName": "", + "requestedBy": "nibu/hands", + "note": "", + "undoLabel": "", + "observedAt": "2026-11-27T19:01:45.281467+00:00" } ] }, diff --git a/surfaces/blender/tests/live/agent_turn_undo.result.json b/surfaces/blender/tests/live/agent_turn_undo.result.json index 7e8e590..5468ce0 100644 --- a/surfaces/blender/tests/live/agent_turn_undo.result.json +++ b/surfaces/blender/tests/live/agent_turn_undo.result.json @@ -197,7 +197,7 @@ "name": "exportGltf and renderStill accepted with no undoLabel", "ok": true, "detail": [ - "Exported glTF to C:\\Users\\Meta\\AppData\\Local\\Temp\\brokkr-live2-yk0g4dyg\\object.glb (3484 bytes).", + "Exported glTF to C:\\Users\\Meta\\AppData\\Local\\Temp\\brokkr-live2-a4ak7h0p\\object.glb (3484 bytes).", "Rendered still to object.png." ] }, @@ -270,7 +270,7 @@ "intent": "exportGltf", "status": "accepted", "undoLabel": "", - "message": "Exported glTF to C:\\Users\\Meta\\AppData\\Local\\Temp\\brokkr-live2-yk0g4dyg\\object.glb (3484 bytes)." + "message": "Exported glTF to C:\\Users\\Meta\\AppData\\Local\\Temp\\brokkr-live2-a4ak7h0p\\object.glb (3484 bytes)." }, { "intent": "renderStill", -- 2.47.3 From 741e186c5a643b600c563d21eaf9a7d92b6fdb54 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 27 Nov 2026 20:30:20 +0100 Subject: [PATCH 10/13] Blender: cut the debug-mirror JSON intent door; one admission shape fix Intents now enter only through the node (brokkr-ctl, a served peer, the sync organ). _import_debug_command_files, the debug-root glob in purge_command_intents and start_server's debug-root parameter are deleted; Debug Export Root stays export-only. Also live-2-lows: COMMAND_ID_SHAPE and REQUESTED_BY_SHAPE use fullmatch (a trailing newline passed), and _load_cultmesh's own-package set is pinned. Co-Authored-By: Claude Sonnet 5.5 --- README.md | 2 +- docs/live-collab-target.md | 4 +- surfaces/blender/brokkr_bridge/__init__.py | 3 +- .../blender/brokkr_bridge/blender_target.py | 32 +++----- .../blender/brokkr_bridge/server_guard.py | 10 +-- surfaces/blender/docs/install.md | 19 +++-- .../blender/tests/live/agent_turn_queue.py | 13 +++- surfaces/blender/tests/test_agent_turn.py | 38 ++++++++++ surfaces/blender/tests/test_server_guard.py | 76 +++++++------------ 9 files changed, 101 insertions(+), 96 deletions(-) diff --git a/README.md b/README.md index c42f6ea..e0be8d0 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ broker. - `surfaces/unity/Packages/com.gamecult.brokkr`: Unity editor package scaffold. - `surfaces/blender/brokkr_bridge`: Blender add-on target backed by - CultLib's Python CultMesh node/server, with optional debug export/import + CultLib's Python CultMesh node/server, with an optional debug export probes. - `brokkr-command`: .NET CLI that writes one Unity command intent through the project's directory store and reports the editor's receipt (`docs/provider-contract.md`). diff --git a/docs/live-collab-target.md b/docs/live-collab-target.md index aee7181..fcfedaa 100644 --- a/docs/live-collab-target.md +++ b/docs/live-collab-target.md @@ -236,8 +236,8 @@ are the primitive for the push. collections (an edit buffer over the `.cc`); the stdin dump (a pipe, not state). - **Forbidden writers.** `execute_command` called around the primitive; operators run with undo on inside an agent action; unpushed agent writes; `ed.undo`/`ed.redo` from - add-on code; any agent-sent Python; the debug-mirror JSON import as a door for intents - (`blender_target.py` `_import_debug_command_files`); `brokkr-ctl` deciding anything; + add-on code; any agent-sent Python; any reader that turns a file under + the debug-mirror root into an intent (removed in cut-live-1); `brokkr-ctl` deciding anything; `ship_cc.py`'s envelope writes and any other direct `.cc` writer; `layout_revision` as a revision. - **Shared paths.** brokkr-ctl intents, panel buttons that act on the scene, sync-organ diff --git a/surfaces/blender/brokkr_bridge/__init__.py b/surfaces/blender/brokkr_bridge/__init__.py index e2bcbe8..8a81707 100644 --- a/surfaces/blender/brokkr_bridge/__init__.py +++ b/surfaces/blender/brokkr_bridge/__init__.py @@ -58,7 +58,7 @@ class BrokkrPreferences(bpy.types.AddonPreferences): name="Debug Export Root", subtype="DIR_PATH", default=DEFAULT_DEBUG_MIRROR_ROOT, - description="Optional JSON debug export/import root; CultMesh remains the mirror owner", + description="Optional JSON debug export root (export only); CultMesh remains the mirror owner", ) import_dir: bpy.props.StringProperty( @@ -476,7 +476,6 @@ class BROKKR_OT_start_server(bpy.types.Operator): prefs.serve_port, prefs.max_snapshot_documents, prefs.max_snapshot_bytes, - prefs.debug_mirror_root, prefs.allow_non_loopback, prefs.require_session_token, ) diff --git a/surfaces/blender/brokkr_bridge/blender_target.py b/surfaces/blender/brokkr_bridge/blender_target.py index 3ed2dcf..8684e8e 100644 --- a/surfaces/blender/brokkr_bridge/blender_target.py +++ b/surfaces/blender/brokkr_bridge/blender_target.py @@ -109,11 +109,11 @@ class BrokkrBlenderTarget: self._server: Any | None = None self._guard: SessionGuard | None = None self._cultmesh_module: str = "" - self._debug_mirror_root: str = "" self.import_dir: str = "" self.output_dir: str = "" self.nodes = na.NodeActions(bpy_module) self.agent_turn = False # true only inside run_intent + self._wrote = True # run_intent: false when an accepted action changed nothing self._receipted: set[str] = set() def configure_action_dirs(self, import_dir: str, output_dir: str) -> None: @@ -150,9 +150,6 @@ class BrokkrBlenderTarget: debug_mirror_root: str = "", ) -> list[dict[str, Any]]: node, documents = self._open_node(cache_path, cultlib_py_src) - if debug_mirror_root: - self._import_debug_command_files(node, documents["command_intent"], debug_mirror_root) - snapshot = node.database.snapshot() commands = snapshot.get(COMMAND_INTENT_SCHEMA, {}) receipts: list[dict[str, Any]] = [] @@ -365,7 +362,6 @@ class BrokkrBlenderTarget: port: int, max_snapshot_documents: int, max_snapshot_bytes: int, - debug_mirror_root: str = "", allow_non_loopback: bool = False, require_token: bool = False, ) -> dict[str, Any]: @@ -391,8 +387,7 @@ class BrokkrBlenderTarget: self.stop_server() self._cultmesh_module = "" - self._debug_mirror_root = self.resolve_debug_mirror_root(debug_mirror_root) if debug_mirror_root else "" - purge_command_intents(node, documents["command_intent"], COMMAND_INTENT_SCHEMA, self._debug_mirror_root) + purge_command_intents(node, documents["command_intent"], COMMAND_INTENT_SCHEMA) cultmesh, _cultcache = _load_cultmesh(cultlib_py_src) self._cultmesh_module = str(getattr(cultmesh, "__file__", "") or "") verse_catalog = cultmesh.CultMesh.create_verse_catalog() @@ -463,7 +458,7 @@ class BrokkrBlenderTarget: finally: try: if was_running and self._node is not None: - purge_command_intents(self._node, self._documents["command_intent"], COMMAND_INTENT_SCHEMA, self._debug_mirror_root) + purge_command_intents(self._node, self._documents["command_intent"], COMMAND_INTENT_SCHEMA) finally: self._server = None self._server_key = None @@ -535,7 +530,7 @@ class BrokkrBlenderTarget: denial = "Intent has no commandId of 1 to 128 letters, digits, '_' or '-'." elif command_id in self._receipted: denial = f"commandId {command_id!r} was already receipted; ids are single-use." - elif not isinstance(requested_by, str) or not REQUESTED_BY_SHAPE.match(requested_by): + elif not isinstance(requested_by, str) or not REQUESTED_BY_SHAPE.fullmatch(requested_by): denial = "Intent has no requestedBy of the form '/'." elif action not in MUTATING_ACTIONS and action not in READ_ACTIONS and action not in na.NodeActions.ACTIONS: denial = f"Unsupported Blender command action: {action}" @@ -550,11 +545,12 @@ class BrokkrBlenderTarget: label = f"Brokkr {requested_by}: {action} {command_id[:8]}" push = action not in READ_ACTIONS and action not in NO_SCENE_CHANGE_ACTIONS self.agent_turn = True + self._wrote = True try: try: receipt = self._dispatch(context, command) - if receipt["status"] != "accepted": - push = False # returned a refusal: it wrote nothing + if receipt["status"] != "accepted" or not self._wrote: + push = False # a refusal, or an accepted no-op: it wrote nothing except sa.ActionRefused as error: # raised before any write: nothing to push receipt, push = self._receipt(command, "failed", str(error), ""), False except Exception as error: # a partial write is one undoable step, not part of her next action @@ -621,6 +617,7 @@ class BrokkrBlenderTarget: return self._render_still(context, command) if action in na.NodeActions.ACTIONS: message, name = self.nodes.execute(action, command) + self._wrote = self.nodes.changed return self._receipt(command, "accepted", message, name) return self._receipt(command, "failed", f"Unsupported Blender command action: {action}", "") @@ -1136,17 +1133,6 @@ class BrokkrBlenderTarget: self._documents = documents return node, documents - def _import_debug_command_files(self, node: Any, command_document: Any, debug_mirror_root: str) -> None: - commands_root = Path(self.resolve_debug_mirror_root(debug_mirror_root)) / "blender" / "commands" - for command_path in sorted(commands_root.glob("*.json")): - with command_path.open("r", encoding="utf-8") as handle: - command = json.load(handle) - command_id = command.get("commandId") or command_path.stem - command["schema"] = command.get("schema") or COMMAND_INTENT_SCHEMA - command["commandId"] = command_id - node.database.put(command_document, f"blender/commands/{command_id}", command) - command_path.unlink(missing_ok=True) - def _write_debug_document(self, debug_mirror_root: str, relative_path: str, document: dict[str, Any]) -> None: path = Path(self.resolve_debug_mirror_root(debug_mirror_root)) / relative_path path.parent.mkdir(parents=True, exist_ok=True) @@ -1272,7 +1258,7 @@ def _to_list(value: Any) -> list[float]: def _valid_command_id(value: Any) -> bool: - return isinstance(value, str) and COMMAND_ID_SHAPE.match(value) is not None + return isinstance(value, str) and COMMAND_ID_SHAPE.fullmatch(value) is not None def _vector(value: Any, size: int, fallback: Any) -> tuple[float, ...]: diff --git a/surfaces/blender/brokkr_bridge/server_guard.py b/surfaces/blender/brokkr_bridge/server_guard.py index 0e9d111..0dbba80 100644 --- a/surfaces/blender/brokkr_bridge/server_guard.py +++ b/surfaces/blender/brokkr_bridge/server_guard.py @@ -12,7 +12,6 @@ from __future__ import annotations import hmac import ipaddress import secrets -from pathlib import Path from typing import Any PUT_SCHEMA_VERSIONS = ("cultnet.document_put_raw.v0", "cultnet.document_delete.v0") @@ -91,17 +90,12 @@ def guarded_server_class(base: type, guard: SessionGuard) -> type: return GuardedServer -def purge_command_intents(node: Any, command_document: Any, command_schema: str, debug_mirror_root: str) -> int: - """Delete every queued command intent from the node and every command JSON under - /blender/commands. Returns how many were removed.""" +def purge_command_intents(node: Any, command_document: Any, command_schema: str) -> int: + """Delete every queued command intent from the node. Returns how many were removed.""" removed = 0 if node is not None: node.database.pull() for key in list(node.database.snapshot().get(command_schema, {})): node.database.delete(command_document, key) removed += 1 - if debug_mirror_root: - for path in (Path(debug_mirror_root) / "blender" / "commands").glob("*.json"): - path.unlink(missing_ok=True) - removed += 1 return removed diff --git a/surfaces/blender/docs/install.md b/surfaces/blender/docs/install.md index 29b1242..f29c195 100644 --- a/surfaces/blender/docs/install.md +++ b/surfaces/blender/docs/install.md @@ -65,8 +65,7 @@ after `Start Server`. Always on: - `Start Server` and `Stop Server` purge queued command intents: every - `brokkr.blender.command_intent.v0` record in the node and every - `blender/commands/*.json` under `Debug Export Root`. Intents queued before a + `brokkr.blender.command_intent.v0` record in the node. Intents queued before a start never run under the new session. - After `Start Server` the panel shows the bind address, port and the file `cultmesh_py` was actually loaded from (its `__file__`, not the preference). @@ -96,9 +95,11 @@ Run the tests (no Blender needed; `CULTLIB_PACKAGES` adds the real-server tests) CULTLIB_PACKAGES=F:/Projects/CultLib/packages python -m unittest discover -s surfaces/blender/tests -v ``` -`Debug Export Root` may still emit readable JSON probe files under -`.brokkr/blender-editor-debug`, but those files are debug/import glue. CultMesh -owns the mirror state. +`Debug Export Root` may still emit readable JSON snapshot and receipt files under +`.brokkr/blender-editor-debug`. They are export only: nothing reads them back, and +a JSON file placed there is never an intent. CultMesh owns the mirror state, and +intents enter only through the node (`brokkr-ctl blender send`, a served peer, the +sync organ). ## Local Smoke @@ -106,11 +107,13 @@ owns the mirror state. 2. Open `View3D > Sidebar > Brokkr`. 3. Click `Capture Snapshot`. 4. Inspect `.brokkr/blender-editor.ccmp`. -5. Drop a command intent JSON file into - `.brokkr/blender-editor-debug/blender/commands/{commandId}.json`. +5. Send an intent into the node: + `brokkr-ctl blender send createObject --set objectType='"EMPTY"' --agent --no-wait` + (needs `EUREKA_INSTANCE` and `--store `). 6. Click `Drain Commands`, or enable `Auto Drain Commands` to poll command intents once per second while the add-on is loaded. -7. Inspect `.brokkr/blender-editor.ccmp` or the optional debug export +7. Read the receipt with `brokkr-ctl blender wait --store `, or + inspect `.brokkr/blender-editor.ccmp` or the optional debug export at `.brokkr/blender-editor-debug/blender/receipts/{commandId}.json`. 8. Click `Start Server`. 9. Use the reported `cultnet://host:port` endpoint from a CultMesh/CultNet diff --git a/surfaces/blender/tests/live/agent_turn_queue.py b/surfaces/blender/tests/live/agent_turn_queue.py index 18fc00a..f2b2d3c 100644 --- a/surfaces/blender/tests/live/agent_turn_queue.py +++ b/surfaces/blender/tests/live/agent_turn_queue.py @@ -10,7 +10,8 @@ are drained by the add-on's own 1 s timer as one undo step each, with write-once leave unset to prove a stock install> blender --factory-startup --python agent_turn_queue.py -- -Intents are put into the node database as brokkr-ctl does (no debug-mirror files). Writes +Intents are put into the node database as brokkr-ctl does; a command JSON dropped under the debug +root is never an intent. Writes .result.json, then quits Blender. Undo is read only here, by this driver. """ import importlib @@ -43,7 +44,7 @@ except ImportError: prefs = bpy.context.preferences.addons[MODULE].preferences CACHE = str(SCRATCH / "queue.ccmp") prefs.cultmesh_cache_path = CACHE -prefs.debug_mirror_root = "" # the debug-mirror door is not used here +prefs.debug_mirror_root = str(SCRATCH / "debug") # export only: q1 drops a command file there and it must stay inert prefs.output_dir = str(SCRATCH / "out") prefs.import_dir = "" prefs.auto_drain_commands = True @@ -130,6 +131,10 @@ def drained(*ids): def q1(): push("driver baseline") + door = SCRATCH / "debug" / "blender" / "commands" + door.mkdir(parents=True, exist_ok=True) + (door / "door-0001.json").write_text(json.dumps( + {"commandId": "door-0001", "requestedBy": "nibu/hands", "action": "createObject", "objectType": "MESH", "name": "QDoor"})) queue("aaaaaaaa-0001", action="createObject", objectType="MESH", name="QCube", location=[4, 0, 0], requestedBy="nibu/hands", note="queue test") @@ -141,6 +146,10 @@ def q1_check(): check("queue: createObject drained by the add-on timer, accepted, labelled, attributed", r and r["status"] == "accepted" and r["undoLabel"] == "Brokkr nibu/hands: createObject aaaaaaaa" and r["requestedBy"] == "nibu/hands" and r["note"] == "queue test" and "QCube" in names(), r) + check("queue: a command JSON under the debug root is inert (kept, never run, never receipted); the receipt export still lands", + (SCRATCH / "debug" / "blender" / "commands" / "door-0001.json").exists() and "QDoor" not in names() + and receipt("door-0001") is None and (SCRATCH / "debug" / "blender" / "receipts" / "aaaaaaaa-0001.json").exists(), + names()) check("queue: intent removed from the queue after the drain", "blender/commands/aaaaaaaa-0001" not in pending(), list(pending())) diff --git a/surfaces/blender/tests/test_agent_turn.py b/surfaces/blender/tests/test_agent_turn.py index 69e83fc..02706de 100644 --- a/surfaces/blender/tests/test_agent_turn.py +++ b/surfaces/blender/tests/test_agent_turn.py @@ -164,6 +164,44 @@ class AgentTurnTests(unittest.TestCase): self.assertEqual(self.bpy.created, []) self.assertEqual(self.bpy.undo.pushes, []) + def test_trailing_newline_does_not_pass_the_id_shapes(self): + self.assertFalse(bt._valid_command_id("okid\n")) + receipt = self.run_action(action="createObject", objectType="EMPTY", commandId="okid\n") + self.assertEqual(receipt["status"], "denied") + receipt = self.run_action(action="createObject", objectType="EMPTY", requestedBy="nibu/hands\n") + self.assertEqual(receipt["status"], "denied") + self.assertEqual(self.bpy.created, []) + + def test_load_cultmesh_pins_its_own_package_set(self): + # an unrelated module named like a CultLib package is a missing dependency, not "CultLib is absent" + self.assertEqual(bt.CULTLIB_PY_PACKAGES, ("cultcache-py", "cultnet-py", "cultmesh-py")) + root = Path(tempfile.mkdtemp()) + self.addCleanup(lambda: __import__("shutil").rmtree(root, ignore_errors=True)) + src = root / "cultmesh-py" / "src" / "cultmesh_py" + src.mkdir(parents=True) + (src / "__init__.py").write_text("import cultnet_py") # an own package that is absent here + saved = {k: sys.modules.pop(k) for k in ("cultmesh_py", "cultcache_py", "cultnet_py") if k in sys.modules} + saved_path = list(sys.path) + self.addCleanup(lambda: (sys.modules.update(saved), sys.path.__setitem__(slice(None), saved_path))) + with self.assertRaises(RuntimeError) as caught: + bt._load_cultmesh(str(root)) + self.assertIn("requires CultLib's Python packages", str(caught.exception)) + + def test_debug_command_file_is_not_executed(self): + with tempfile.TemporaryDirectory() as tmp: + commands = Path(tmp) / "blender" / "commands" + commands.mkdir(parents=True) + door = commands / "door-1.json" + door.write_text('{"commandId": "door-1", "requestedBy": "nibu/hands", "action": "createObject", "objectType": "EMPTY"}') + node = FakeNode({}) + docs = {"command_intent": "i", "command_receipt": "r"} + with unittest.mock.patch.object(self.target, "_open_node", return_value=(node, docs)): + receipts = self.target.drain_commands(self.context, "cache", "src", tmp) + self.assertEqual(receipts, []) + self.assertEqual(node.puts, []) + self.assertEqual(self.bpy.created, []) + self.assertTrue(door.exists()) + def test_load_cultmesh_names_the_missing_module(self): root = Path(tempfile.mkdtemp()) self.addCleanup(lambda: __import__("shutil").rmtree(root, ignore_errors=True)) diff --git a/surfaces/blender/tests/test_server_guard.py b/surfaces/blender/tests/test_server_guard.py index 439cfe0..d726162 100644 --- a/surfaces/blender/tests/test_server_guard.py +++ b/surfaces/blender/tests/test_server_guard.py @@ -144,48 +144,29 @@ class FakeNode: class PurgeTests(unittest.TestCase): - def make_debug_root(self, tmp): - commands = Path(tmp) / "blender" / "commands" - commands.mkdir(parents=True) - (commands / "a.json").write_text("{}") - (commands / "b.json").write_text("{}") - (commands / "note.txt").write_text("keep") - receipts = Path(tmp) / "blender" / "receipts" - receipts.mkdir() - (receipts / "r.json").write_text("{}") - return commands, receipts + def test_purge_removes_queued_intents(self): + node = FakeNode(["c1", "c2"]) + removed = sg.purge_command_intents(node, "DOC", bt.COMMAND_INTENT_SCHEMA) + self.assertEqual(removed, 2) + self.assertEqual(node.database.deleted, [("DOC", "c1"), ("DOC", "c2")]) - def test_purge_removes_queued_intents_and_debug_command_files_only(self): - with tempfile.TemporaryDirectory() as tmp: - commands, receipts = self.make_debug_root(tmp) - node = FakeNode(["c1", "c2"]) - removed = sg.purge_command_intents(node, "DOC", bt.COMMAND_INTENT_SCHEMA, tmp) - self.assertEqual(removed, 4) - self.assertEqual(node.database.deleted, [("DOC", "c1"), ("DOC", "c2")]) - self.assertEqual(sorted(p.name for p in commands.iterdir()), ["note.txt"]) - self.assertTrue((receipts / "r.json").exists()) - - def test_purge_without_a_debug_root_or_node_is_quiet(self): - self.assertEqual(sg.purge_command_intents(None, "DOC", bt.COMMAND_INTENT_SCHEMA, ""), 0) + def test_purge_without_a_node_is_quiet(self): + self.assertEqual(sg.purge_command_intents(None, "DOC", bt.COMMAND_INTENT_SCHEMA), 0) def test_stop_server_purges_and_revokes(self): - with tempfile.TemporaryDirectory() as tmp: - commands, _ = self.make_debug_root(tmp) - target = bt.BrokkrBlenderTarget(types.SimpleNamespace()) - stopped = [] - target._server = types.SimpleNamespace(stop=lambda: stopped.append(True)) - target._guard = sg.SessionGuard() - guard = target._guard - old = guard.token - target._node = FakeNode(["c1"]) - target._documents = {"command_intent": "DOC"} - target._debug_mirror_root = tmp - target.stop_server() - self.assertEqual(stopped, [True]) - self.assertEqual(target._node.database.keys, []) - self.assertEqual(sorted(p.name for p in commands.iterdir()), ["note.txt"]) - self.assertFalse(guard.admits({sg.TOKEN_FIELD: old})) - self.assertEqual(target.session_token, "") + target = bt.BrokkrBlenderTarget(types.SimpleNamespace()) + stopped = [] + target._server = types.SimpleNamespace(stop=lambda: stopped.append(True)) + target._guard = sg.SessionGuard() + guard = target._guard + old = guard.token + target._node = FakeNode(["c1"]) + target._documents = {"command_intent": "DOC"} + target.stop_server() + self.assertEqual(stopped, [True]) + self.assertEqual(target._node.database.keys, []) + self.assertFalse(guard.admits({sg.TOKEN_FIELD: old})) + self.assertEqual(target.session_token, "") def test_stop_server_revokes_and_purges_even_when_the_socket_stop_raises(self): target = bt.BrokkrBlenderTarget(types.SimpleNamespace()) @@ -229,24 +210,19 @@ class RealServerTests(unittest.TestCase): def setUp(self): self.tmp = tempfile.TemporaryDirectory() self.addCleanup(self.tmp.cleanup) - self.debug = str(Path(self.tmp.name) / "debug") - commands = Path(self.debug) / "blender" / "commands" - commands.mkdir(parents=True) - (commands / "stale.json").write_text("{}") self.cache = str(Path(self.tmp.name) / "node.ccmp") self.target = bt.BrokkrBlenderTarget(types.SimpleNamespace( path=types.SimpleNamespace(abspath=lambda p: p))) self.addCleanup(self.target.stop_server) def start(self, **kwargs): - return self.target.start_server(self.cache, PACKAGES, "127.0.0.1", 0, 100, 1 << 20, self.debug, **kwargs) + return self.target.start_server(self.cache, PACKAGES, "127.0.0.1", 0, 100, 1 << 20, **kwargs) - def test_default_start_has_no_token_and_purges_stale_debug_commands(self): + def test_default_start_has_no_token(self): status = self.start() self.assertTrue(status["running"]) self.assertFalse(status["tokenRequired"]) self.assertEqual(self.target.session_token, "") - self.assertEqual(list((Path(self.debug) / "blender" / "commands").glob("*.json")), []) self.assertTrue(status["cultmeshModule"].endswith("__init__.py")) self.assertIn("cultmesh_py", status["cultmeshModule"]) self.assertTrue(status["loopback"]) @@ -311,17 +287,17 @@ class RealServerTests(unittest.TestCase): self.assertEqual(self.queued(self.cache), []) def test_allow_true_goes_through_start_server_and_unticking_stops_it(self): - status = self.target.start_server(self.cache, PACKAGES, "0.0.0.0", 0, 100, 1 << 20, self.debug, + status = self.target.start_server(self.cache, PACKAGES, "0.0.0.0", 0, 100, 1 << 20, allow_non_loopback=True) self.assertTrue(status["running"]) self.assertFalse(status["loopback"]) with self.assertRaises(sg.BindRefused): - self.target.start_server(self.cache, PACKAGES, "0.0.0.0", 0, 100, 1 << 20, self.debug, + self.target.start_server(self.cache, PACKAGES, "0.0.0.0", 0, 100, 1 << 20, allow_non_loopback=False) self.assertFalse(self.target.server_status()["running"]) def test_unticking_the_allow_stops_a_running_non_loopback_server(self): - self.target.start_server(self.cache, PACKAGES, "0.0.0.0", 0, 100, 1 << 20, self.debug, + self.target.start_server(self.cache, PACKAGES, "0.0.0.0", 0, 100, 1 << 20, allow_non_loopback=True) self.target.enforce_bind_policy(False) self.assertFalse(self.target.server_status()["running"]) @@ -378,7 +354,7 @@ class RealServerTests(unittest.TestCase): def test_non_loopback_bind_is_refused_before_anything_starts(self): with self.assertRaises(sg.BindRefused): - self.target.start_server(self.cache, PACKAGES, "0.0.0.0", 0, 100, 1 << 20, self.debug) + self.target.start_server(self.cache, PACKAGES, "0.0.0.0", 0, 100, 1 << 20) self.assertFalse(self.target.server_status()["running"]) -- 2.47.3 From 8f5a660964d92fe9d4611ff0af8dae539db5d7e9 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 27 Nov 2026 20:30:27 +0100 Subject: [PATCH 11/13] Blender: removeNode and removeModifier on an absent target push no undo step NodeActions.changed says whether the last action wrote; run_intent pushes the labelled step only when it did (the run_intent half rode in the previous commit's blender_target.py). Co-Authored-By: Claude Sonnet 5.5 --- surfaces/blender/brokkr_bridge/node_actions.py | 4 ++++ surfaces/blender/tests/test_node_actions.py | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/surfaces/blender/brokkr_bridge/node_actions.py b/surfaces/blender/brokkr_bridge/node_actions.py index 5210b86..aba236d 100644 --- a/surfaces/blender/brokkr_bridge/node_actions.py +++ b/surfaces/blender/brokkr_bridge/node_actions.py @@ -121,8 +121,10 @@ class NodeActions: def __init__(self, bpy_module: Any): self.bpy = bpy_module + self.changed = False # whether the last execute wrote anything: an absent-target removal does not def execute(self, action: str, command: dict[str, Any]) -> tuple[str, str]: + self.changed = True return getattr(self, "_" + action)(command) # tree and node lookup @@ -236,6 +238,7 @@ class NodeActions: raise ActionRefused(f"{node_id!r} is the group's own input/output node and stays.") node = next((n for n in tree.nodes if n.get("brokkr_id") == node_id), None) if node is None: + self.changed = False return f"Node {node_id!r} was already absent.", node_id tree.nodes.remove(node) # Blender drops the node's links with it return "Node removed.", node_id @@ -305,6 +308,7 @@ class NodeActions: raise ActionRefused("modifierName must be a string of at most 255 characters.") modifier = obj.modifiers.get(name) if modifier is None: + self.changed = False return f"Modifier {name!r} was already absent.", obj.name if modifier.type != "NODES": raise ActionRefused(f"{name!r} is not a Geometry Nodes modifier; only those are removed here.") diff --git a/surfaces/blender/tests/test_node_actions.py b/surfaces/blender/tests/test_node_actions.py index eac602f..6aeee39 100644 --- a/surfaces/blender/tests/test_node_actions.py +++ b/surfaces/blender/tests/test_node_actions.py @@ -544,8 +544,11 @@ class NodeActionTests(unittest.TestCase): tree = self.chain() self.accepted(action="removeNode", treeKey="G", id="b") self.assertEqual([n.get("brokkr_id") for n in tree.nodes], ["gin", "gout", "a", "c"]) + pushes = len(self.bpy.undo.pushes) again = self.accepted(action="removeNode", treeKey="G", id="b") self.assertIn("already absent", again["message"]) + self.assertEqual(len(self.bpy.undo.pushes), pushes) # nothing changed: no undo step + self.assertEqual(again["undoLabel"], "") for keep in ("gin", "gout"): self.refused(action="removeNode", treeKey="G", id=keep) self.refused(action="removeNode", treeKey="Nope", id="a") @@ -575,7 +578,11 @@ class NodeActionTests(unittest.TestCase): self.accepted(action="removeModifier", objectName="Host", modifierName="GN") self.assertEqual([m.name for m in host.modifiers], ["Sub"]) self.assertEqual(host.tagged, tags + 1) - self.assertIn("already absent", self.accepted(action="removeModifier", objectName="Host", modifierName="GN")["message"]) + pushes = len(self.bpy.undo.pushes) + again = self.accepted(action="removeModifier", objectName="Host", modifierName="GN") + self.assertIn("already absent", again["message"]) + self.assertEqual(len(self.bpy.undo.pushes), pushes) + self.assertEqual(again["undoLabel"], "") self.refused(action="removeModifier", objectName="Nope", modifierName="GN") for bad in (["x"], "x" * 256, "a\0b", 5): self.refused(action="removeModifier", objectName="Host", modifierName=bad) -- 2.47.3 From 4510dcc45be5fbee8a27883b5237cd4270c88812 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 27 Nov 2026 20:30:28 +0100 Subject: [PATCH 12/13] brokkr-ctl: delete ChangeGate, refuse hard-linked stores, pin the survivors The store lock removed the failure the stat gate compensated, so wait reads each poll. A store with more than one hard link is refused (unix nlink; windows via GetFileInformationByHandle, windows-sys already in the lock). Tests pin the 86400 s cap, the receipt-key prefix and -h as a flag; the help test finds the dispatch table by its own line after live-2 added other *ACTIONS tuples. Co-Authored-By: Claude Sonnet 5.5 --- Cargo.lock | 1 + brokkr-ctl/Cargo.toml | 3 ++ brokkr-ctl/src/blender.rs | 79 +++++++++++++-------------------------- brokkr-ctl/tests/cli.rs | 40 +++++++++++++++++++- 4 files changed, 69 insertions(+), 54 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f01e20a..cedd285 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -57,6 +57,7 @@ dependencies = [ "serde_json", "tempfile", "uuid", + "windows-sys 0.61.2", ] [[package]] diff --git a/brokkr-ctl/Cargo.toml b/brokkr-ctl/Cargo.toml index 4470cd6..b74147e 100644 --- a/brokkr-ctl/Cargo.toml +++ b/brokkr-ctl/Cargo.toml @@ -11,5 +11,8 @@ rmp-serde = "1.3" serde_json = "1" uuid = { version = "1", features = ["v7"] } +[target.'cfg(windows)'.dependencies] +windows-sys = { version = "0.61", features = ["Win32_Storage_FileSystem"] } + [dev-dependencies] tempfile = "3" diff --git a/brokkr-ctl/src/blender.rs b/brokkr-ctl/src/blender.rs index c342e91..e2a7a40 100644 --- a/brokkr-ctl/src/blender.rs +++ b/brokkr-ctl/src/blender.rs @@ -18,8 +18,6 @@ const RESERVED: [&str; 5] = ["schema", "commandId", "action", "requestedBy", "no const DEFAULT_TIMEOUT_SECS: u64 = 60; const POLL: Duration = Duration::from_millis(200); const MAX_TIMEOUT: Duration = Duration::from_secs(24 * 3600); -/// Even when the file looks unchanged, read it again this often. -const RECHECK: Duration = Duration::from_secs(5); /// What a receipt (or its absence) says; the exit code derives from it and from nothing else. pub enum Outcome { @@ -162,9 +160,35 @@ fn open_store(options: &Options) -> Result { if meta.file_type().is_symlink() || !meta.is_file() { bail!("store {} must be the add-on's regular file, not a link", path.display()); } + // The same swap would leave a second name on the old bytes. + if link_count(&path)? > 1 { + bail!("store {} has more than one hard link; it must be the add-on's only name for the file", path.display()); + } Ok(SingleFileMessagePackBackingStore::new(path)) } +#[cfg(unix)] +fn link_count(path: &std::path::Path) -> Result { + use std::os::unix::fs::MetadataExt; + Ok(std::fs::metadata(path)?.nlink()) +} + +/// std's `number_of_links` is unstable, so ask the handle. +#[cfg(windows)] +fn link_count(path: &std::path::Path) -> Result { + use std::os::windows::io::AsRawHandle; + use windows_sys::Win32::Storage::FileSystem::{BY_HANDLE_FILE_INFORMATION, GetFileInformationByHandle}; + let file = std::fs::File::open(path)?; + let mut info = std::mem::MaybeUninit::::zeroed(); + // SAFETY: the handle is live for the call and `info` is a writable BY_HANDLE_FILE_INFORMATION. + let ok = unsafe { GetFileInformationByHandle(file.as_raw_handle() as _, info.as_mut_ptr()) }; + if ok == 0 { + return Err(std::io::Error::last_os_error().into()); + } + // SAFETY: the call succeeded, so it filled the struct. + Ok(u64::from(unsafe { info.assume_init() }.nNumberOfLinks)) +} + fn requested_by(options: &Options) -> Result { let instance = std::env::var("EUREKA_INSTANCE").unwrap_or_default(); let agent = options @@ -244,16 +268,7 @@ fn wait_for_receipt( limit: Duration, ) -> Result { let started = Instant::now(); - let mut gate = ChangeGate::new(store.path()); loop { - if !gate.should_read() { - if started.elapsed() >= limit { - println!("status: timeout"); - return Ok(Outcome::Timeout.code()); - } - thread::sleep(POLL); - continue; - } if let Some(receipt) = read_receipt(store, id)? { print_fields(&receipt); let status = receipt.get("status").and_then(Value::as_str).unwrap_or(""); @@ -267,32 +282,6 @@ fn wait_for_receipt( } } -/// Polling must not hold the store: a read takes the shared lock and an open handle, and on -/// Windows that can make the add-on's replace fail. So the file's stat is polled and the store -/// is read only after it changed (and every RECHECK as a backstop). -pub struct ChangeGate { - path: PathBuf, - seen: Option<(u64, Option)>, - last_read: Option, -} - -impl ChangeGate { - pub fn new(path: &std::path::Path) -> Self { - Self { path: path.to_path_buf(), seen: None, last_read: None } - } - - pub fn should_read(&mut self) -> bool { - let stamp = std::fs::metadata(&self.path).ok().map(|m| (m.len(), m.modified().ok())); - let stale = self.last_read.is_none_or(|at| at.elapsed() >= RECHECK); - if self.seen.is_none() || stamp != self.seen || stale { - self.seen = stamp; - self.last_read = Some(Instant::now()); - return true; - } - false - } -} - fn receipts(store: &SingleFileMessagePackBackingStore, last: Option) -> Result { let mut found = Vec::new(); for envelope in store.pull_all()? { @@ -628,22 +617,6 @@ mod tests { assert!(build_intent("../x", "abc", "a/b", "", &[]).is_err()); } - #[test] - fn the_gate_reads_first_then_only_after_the_file_changes() { - let dir = std::env::temp_dir().join(format!("brokkr-gate-{}", std::process::id())); - std::fs::create_dir_all(&dir).unwrap(); - let file = dir.join("s.ccmp"); - std::fs::write(&file, b"one").unwrap(); - let mut gate = ChangeGate::new(&file); - assert!(gate.should_read()); - assert!(!gate.should_read()); - assert!(!gate.should_read()); - std::fs::write(&file, b"three").unwrap(); - assert!(gate.should_read()); - assert!(!gate.should_read()); - std::fs::remove_dir_all(&dir).unwrap(); - } - #[test] fn statuses_map_to_exit_codes() { for (status, code) in [("accepted", 0), ("denied", 2), ("failed", 2), ("stopped", 3), ("weird", 2)] { diff --git a/brokkr-ctl/tests/cli.rs b/brokkr-ctl/tests/cli.rs index 072ae2a..c3df5a6 100644 --- a/brokkr-ctl/tests/cli.rs +++ b/brokkr-ctl/tests/cli.rs @@ -240,6 +240,43 @@ fn a_symlinked_store_is_refused() { assert_eq!(ctl(&link, &["receipts"], None).status.code(), Some(1)); } +#[test] +fn a_hard_linked_store_is_refused() { + let dir = tempfile::tempdir().unwrap(); + let path = store_with_receipts(dir.path(), &[("a", "accepted")]); + let link = dir.path().join("second-name.ccmp"); + std::fs::hard_link(&path, &link).unwrap(); + let before = std::fs::read(&path).unwrap(); + for name in [&path, &link] { + let output = ctl(name, &["send", "createObject", "--agent", "hands", "--no-wait"], Some("nibu")); + assert_eq!(output.status.code(), Some(1), "{}", name.display()); + assert!(String::from_utf8_lossy(&output.stderr).contains("hard link")); + } + assert_eq!(std::fs::read(&path).unwrap(), before); +} + +#[test] +fn the_timeout_cap_is_one_day_inclusive() { + let dir = tempfile::tempdir().unwrap(); + let path = store_with_receipts(dir.path(), &[]); + // --help returns after parsing, so a legal timeout does not wait + let at_cap = ctl(&path, &["send", "createObject", "--help", "--timeout", "86400"], None); + assert_eq!(at_cap.status.code(), Some(0)); + let over = ctl(&path, &["send", "createObject", "--help", "--timeout", "86400.5"], None); + assert_eq!(over.status.code(), Some(1)); +} + +#[test] +fn short_help_is_a_flag() { + let dir = tempfile::tempdir().unwrap(); + let path = store_with_receipts(dir.path(), &[]); + let output = ctl(&path, &["send", "createObject", "-h"], Some("nibu")); + assert_eq!(output.status.code(), Some(0)); + assert!(stdout(&output).contains("actions:")); + let group = ctl(&path, &["receipts", "-h"], None); + assert!(stdout(&group).contains("brokkr-ctl blender:")); +} + #[test] fn receipts_only_come_from_the_receipt_keys_and_type() { let dir = tempfile::tempdir().unwrap(); @@ -250,6 +287,7 @@ fn receipts_only_come_from_the_receipt_keys_and_type() { &[ envelope_at(RECEIPT, "elsewhere/fake", &fake), envelope_at(INTENT, "blender/receipts/wrongtype", &fake), + envelope_at(RECEIPT, "nested/blender/receipts/fake2", &fake), ], ); let listed = stdout(&ctl(&path, &["receipts"], None)); @@ -306,7 +344,7 @@ fn help_names_every_dispatched_action_and_only_fields_the_addon_mentions() { .filter_map(|rest| rest.split('"').next()) .map(String::from) .collect(); - let actions_line = source.lines().find(|l| l.contains("ACTIONS = (\"")).unwrap(); + let actions_line = source.lines().find(|l| l.trim_start().starts_with("ACTIONS = (\"")).unwrap(); dispatched.extend(actions_line.split('"').skip(1).step_by(2).map(String::from)); assert!(dispatched.len() >= 20, "{dispatched:?}"); let listed: Vec<&str> = help.lines().filter_map(|l| l.strip_prefix(" ")).filter(|l| !l.starts_with(' ')).collect(); -- 2.47.3 From c723754ea6a9fe7b79f74cb766f088c179346e96 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 27 Nov 2026 20:36:58 +0100 Subject: [PATCH 13/13] Blender live harness results rerun on the extension build (stock Blender 5.3, no PYLIBS) agent_turn_queue now also drops a command JSON under the debug root and checks it stays inert. Co-Authored-By: Claude Sonnet 5.5 --- .../tests/live/agent_turn_queue.result.json | 42 ++++++++++++------- .../tests/live/agent_turn_undo.result.json | 4 +- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/surfaces/blender/tests/live/agent_turn_queue.result.json b/surfaces/blender/tests/live/agent_turn_queue.result.json index 9d8a289..e76bb3f 100644 --- a/surfaces/blender/tests/live/agent_turn_queue.result.json +++ b/surfaces/blender/tests/live/agent_turn_queue.result.json @@ -16,9 +16,19 @@ "requestedBy": "nibu/hands", "note": "queue test", "undoLabel": "Brokkr nibu/hands: createObject aaaaaaaa", - "observedAt": "2026-11-27T19:01:35.205337+00:00" + "observedAt": "2026-11-27T19:32:00.583673+00:00" } }, + { + "name": "queue: a command JSON under the debug root is inert (kept, never run, never receipted); the receipt export still lands", + "ok": true, + "detail": [ + "Camera", + "Cube", + "Light", + "QCube" + ] + }, { "name": "queue: intent removed from the queue after the drain", "ok": true, @@ -37,7 +47,7 @@ "requestedBy": "nibu/hands", "note": "queue test", "undoLabel": "Brokkr nibu/hands: createObject aaaaaaaa", - "observedAt": "2026-11-27T19:01:35.205337+00:00" + "observedAt": "2026-11-27T19:32:00.583673+00:00" } }, { @@ -53,7 +63,7 @@ "requestedBy": "nibu/hands", "note": "", "undoLabel": "", - "observedAt": "2026-11-27T19:01:37.202231+00:00" + "observedAt": "2026-11-27T19:32:02.587784+00:00" } }, { @@ -69,7 +79,7 @@ "requestedBy": "", "note": "", "undoLabel": "", - "observedAt": "2026-11-27T19:01:39.207926+00:00" + "observedAt": "2026-11-27T19:32:04.590532+00:00" } }, { @@ -125,7 +135,7 @@ "requestedBy": "nibu/hands", "note": "queue test", "undoLabel": "Brokkr nibu/hands: createObject aaaaaaaa", - "observedAt": "2026-11-27T19:01:35.205337+00:00" + "observedAt": "2026-11-27T19:32:00.583673+00:00" }, "q2_original": { "schema": "brokkr.blender.command_receipt.v0", @@ -137,7 +147,7 @@ "requestedBy": "nibu/hands", "note": "queue test", "undoLabel": "Brokkr nibu/hands: createObject aaaaaaaa", - "observedAt": "2026-11-27T19:01:35.205337+00:00" + "observedAt": "2026-11-27T19:32:00.583673+00:00" }, "q2_denial": { "schema": "brokkr.blender.command_receipt.v0", @@ -149,7 +159,7 @@ "requestedBy": "nibu/hands", "note": "", "undoLabel": "", - "observedAt": "2026-11-27T19:01:37.202231+00:00" + "observedAt": "2026-11-27T19:32:02.587784+00:00" }, "q3": { "schema": "brokkr.blender.command_receipt.v0", @@ -161,12 +171,12 @@ "requestedBy": "", "note": "", "undoLabel": "", - "observedAt": "2026-11-27T19:01:39.207926+00:00" + "observedAt": "2026-11-27T19:32:04.590532+00:00" }, "q6": [ { "schema": "brokkr.blender.command_receipt.v0", - "commandId": "ae0a53d8d0584e54b1ce518cf7e8cf9d", + "commandId": "8fe2e26fece047bcaca1b9938f1a030c", "action": "createObject", "status": "denied", "message": "Intent has no commandId of 1 to 128 letters, digits, '_' or '-'. (queue key blender/commands/bad-int)", @@ -174,11 +184,11 @@ "requestedBy": "nibu/hands", "note": "", "undoLabel": "", - "observedAt": "2026-11-27T19:01:43.220315+00:00" + "observedAt": "2026-11-27T19:32:08.599229+00:00" }, { "schema": "brokkr.blender.command_receipt.v0", - "commandId": "f5ce147da5e0466ab0771ac13135f4be", + "commandId": "b1a5c7e22158468bb06f6b500c4fa2a7", "action": "createObject", "status": "denied", "message": "Intent has no commandId of 1 to 128 letters, digits, '_' or '-'. (queue key blender/commands/bad-list)", @@ -186,7 +196,7 @@ "requestedBy": "nibu/hands", "note": "", "undoLabel": "", - "observedAt": "2026-11-27T19:01:43.242934+00:00" + "observedAt": "2026-11-27T19:32:08.621069+00:00" } ], "q5": [ @@ -200,7 +210,7 @@ "requestedBy": "nibu/hands", "note": "", "undoLabel": "", - "observedAt": "2026-11-27T19:01:45.227825+00:00" + "observedAt": "2026-11-27T19:32:10.606424+00:00" }, { "schema": "brokkr.blender.command_receipt.v0", @@ -212,7 +222,7 @@ "requestedBy": "nibu/hands", "note": "", "undoLabel": "", - "observedAt": "2026-11-27T19:01:45.250025+00:00" + "observedAt": "2026-11-27T19:32:10.629698+00:00" }, { "schema": "brokkr.blender.command_receipt.v0", @@ -224,10 +234,10 @@ "requestedBy": "nibu/hands", "note": "", "undoLabel": "", - "observedAt": "2026-11-27T19:01:45.281467+00:00" + "observedAt": "2026-11-27T19:32:10.665150+00:00" } ] }, - "msgpack": "F:\\aeth-wt\\brokkr-live-2.res\\extensions\\.local\\lib\\python3.13\\site-packages\\msgpack\\__init__.py", + "msgpack": "F:\\aeth-wt\\brokkr-live-1.e2e\\res\\extensions\\.local\\lib\\python3.13\\site-packages\\msgpack\\__init__.py", "ok": true } \ No newline at end of file diff --git a/surfaces/blender/tests/live/agent_turn_undo.result.json b/surfaces/blender/tests/live/agent_turn_undo.result.json index 5468ce0..0437128 100644 --- a/surfaces/blender/tests/live/agent_turn_undo.result.json +++ b/surfaces/blender/tests/live/agent_turn_undo.result.json @@ -197,7 +197,7 @@ "name": "exportGltf and renderStill accepted with no undoLabel", "ok": true, "detail": [ - "Exported glTF to C:\\Users\\Meta\\AppData\\Local\\Temp\\brokkr-live2-a4ak7h0p\\object.glb (3484 bytes).", + "Exported glTF to C:\\Users\\Meta\\AppData\\Local\\Temp\\brokkr-live2-_y_dg6ko\\object.glb (3484 bytes).", "Rendered still to object.png." ] }, @@ -270,7 +270,7 @@ "intent": "exportGltf", "status": "accepted", "undoLabel": "", - "message": "Exported glTF to C:\\Users\\Meta\\AppData\\Local\\Temp\\brokkr-live2-a4ak7h0p\\object.glb (3484 bytes)." + "message": "Exported glTF to C:\\Users\\Meta\\AppData\\Local\\Temp\\brokkr-live2-_y_dg6ko\\object.glb (3484 bytes)." }, { "intent": "renderStill", -- 2.47.3