A live Neural Link attempt to exercise a Neo splitter exposed a tooling gap: the raw event channel can dispatch the necessary mouse events, but the caller must reconstruct Neo's complete drag-arming recipe and cannot tell whether the gesture actually armed.
Live source verification on Engine dev found:
src/ai/client/InteractionService.mjs#simulateEvent() preserves event order and delays, but discards every Boolean returned by dispatch() and returns true after the loop.
src/main/addon/EventSimulator.mjs#dispatch() returns false when the DOM target is absent or event construction/dispatch fails.
src/main/draggable/sensor/Mouse.mjs owns the physical gesture contract: the live delay and minimum-distance thresholds, drag:start, drag:move, drag:end, and lost-release cleanup.
Four tracked Engine consumers currently spell out mousedown / delayed mousemove / mouseup recipes themselves: Workstation, the cross-window dashboard example, and two whitebox journeys.
The history is consistent. Engine issue 12884 explicitly left a simulateDrag convenience primitive out of scope. Engine issue 12807 established the raw Mouse-sensor recipe without adding that primitive. Engine issue 14772 later proved a real cross-window gesture through simulateEvent, but embedded the choreography in a product consumer. Engine issue 16365 demonstrated why event arrival is not equivalent to an armed drag.
The Problem
simulate_event is a useful low-level escape hatch, not a gesture transaction:
callers duplicate sensor timing, movement thresholds, coordinate conversion, and cleanup;
a successful RPC can mean only that the loop completed—even when one event returned false;
dispatch success does not prove that Neo emitted drag:start, processed movement, or reached drag:end;
putting those browser and sensor semantics into the Brain-side MCP service would reverse the repository boundary and make the server duplicate Engine truth.
The missing Engine capability is one atomic, truthful drag execution primitive that the Brain can expose without knowing DOM or sensor internals.
The Architectural Reality
Engine owns both execution realms, with a strict split inside the Body: App-worker InteractionService owns JSON-contract validation plus live cross-window geometry; source-window Main EventSimulator owns the one atomic native transaction.
Every synthetic event dispatches in the source Main realm. Destination/waypoint windows provide geometry only. App resolves target-local BCR anchors through each target window, converts them to global screen points through WindowManager.innerRect, then derives the source-event clientX/Y separately.
DragDrop already creates the one live Mouse sensor per Main realm but discards its handle. It must retain/expose that exact instance so execution reads current per-instance delay / minDistance values; class defaults are not runtime authority.
Mouse remains the gesture state machine. The executor drives mousedown / mousemove / mouseup; it never calls startDrag() or endGesture() on the success path.
Lifecycle proof belongs in source Main: document listeners correlate drag:start, drag:move, and drag:end to the exact native MouseEvent objects constructed by this transaction. Counting an unrelated concurrent drag is forbidden.
The JSON-RPC contract returns a typed success/failure result envelope. Current Engine and Brain error paths discard custom error data, so a thrown Error cannot honestly carry a partial receipt. Brain #204 owns conversion of success:false into an MCP tool error.
Existing simulate_event remains the raw escape hatch. It executes the full caller-supplied sequence and accumulates dispatch success; it must never return early and skip a later cleanup event.
No new production .mjs placement is required: extend the existing Client, InteractionService, EventSimulator, DragDrop, and existing test surfaces.
The Fix
Add InteractionService#driveDrag(), register Engine RPC drive_drag, and extend the existing Main-thread owners without creating a second drag engine.
The request is JSON-first:
{
source: {
targetId: 'required DOM id',
windowId: 'required source window id',
anchor : {x: 0.5, y: 0.5} // optional normalized point, each axis in [0,1]
},
destination: {
// Exactly one mode:targetId: 'target DOM id', windowId: 'target window id', anchor: {x: 0.5, y: 0.5}
// OR target-local point; screen coordinates are derived, never caller-competed:windowId: 'target window id', clientX: 240, clientY: 180// OR source-relative delta:deltaX: 120, deltaY: 0
},
waypoints : [], // optional node or target-local point descriptors; no delta waypoints
steps : 8, // post-arm traversal moves across the WHOLE polyline; integer 1..120durationMs: 160// post-arm traversal duration; >= steps * 16 and <= 30000
}
When durationMs is omitted, Engine derives max(160, steps * 20). This duration begins after arming. Source Main always waits the live Mouse-sensor delay, then dispatches one separate arming move beyond the live minimum distance. The requested path must itself reach that threshold; a short path fails at arming rather than silently overshooting into another drop zone. The threshold-crossing move emits drag:start; steps counts later post-arm moves, so at least one observed drag:move remains possible.
InteractionService resolves every node/point immediately before the call:
node anchors use DomAccess#getBoundingClientRect in that node's own window;
target-local client coordinates plus that window's live innerRect produce the canonical screen point;
screen point minus the source window's innerRect produces the MouseEvent's source-realm clientX/Y;
absent live windows, inner rects, zero/non-finite BCRs, ambiguous modes, and inconsistent values fail at resolution.
It then sends one remote EventSimulator.driveDrag() call to source.windowId. Mousedown targets the source node. Every later move, terminal up, and best-effort cleanup up dispatches on document.body in the source window so source-node replacement cannot strand the Mouse sensor.
Main refuses a second executor while one transaction is active or the live Mouse sensor is already engaged. It correlates lifecycle events by event.detail.originalEvent identity against the native events this transaction constructed.
Failure returns the same receipt fields with success:false, one exact phase
(resolution|busy|arming|dispatch|movement|release|cleanup), and
error:{code,message}. dispatch.moveCount counts raw synthetic moves; observed.moveCount
counts correlated drag:move lifecycle events. Cleanup cannot turn a failed phase into green.
simulateEvent() keeps its Boolean API but executes every event in order, including delays and cleanup events, and returns true only when every delegated dispatch returned true.
The Engine test fixture gains a test-only app.driveDrag(request) wrapper which calls the raw Engine RPC through the existing Neural Link connection. It does not wait for Brain #204's public MCP service. The public Whitebox E2E guide gains the narrow distinction: simulateEvent remains raw sequence control, driveDrag owns complete atomic gestures, and page.mouse remains the right tool when a test must hold or intervene mid-gesture.
Contract Ledger
Target Surface
Source of Authority
Proposed Behavior
Fallback / Edge Case
Docs
Evidence
New Engine RPC drive_drag
This ticket
Route one validated request to existing InteractionService; return typed success/failure envelope
Unknown before this Engine change; no compatibility alias
Client + service JSDoc
Client routing unit
InteractionService#driveDrag()
This ticket; owning Main realm live Neo.Main.getWindowData; WindowManager.calculateGeometry; DomAccess#getBoundingClientRect
Validate discriminated request, resolve node/point/delta geometry, derive target-local/global/source-event coordinates, issue one source-window Main call
Add test-only app.driveDrag(request) over Engine RPC before Brain #204 lands
Missing Engine method fails; no hand-built fallback
Fixture JSDoc
Same-window + cross-window whitebox
Whitebox guide
learn/guides/testing/WhiteboxE2E.md current drag guidance
Distinguish raw sequence, atomic whole gesture, and held/mid-gesture page.mouse use cases
No claim that atomic drive replaces physical held controls
Guide
Link + source review
Brain consumer
neo-agent-brain#204
Brain forwards request and converts Engine success:false into an MCP tool error without reimplementing gesture semantics
Missing method fails clearly; no raw-event fallback
Brain OpenAPI/JSDoc
Cross-repo integration after Engine merge
Decision Record impact
aligned-with ADR 0020 §3 — Neural Link remains the Brain/Body bridge; browser interaction semantics stay Engine-side.
Acceptance Criteria
drive_drag is registered in the Engine client and accepts the exact source plus discriminated node / target-local-point / source-delta contract above; anchors, bounds, finite coordinates, and one-mode-only rules fail closed.
InteractionService resolves BCR/window geometry immediately before execution, derives target-local → screen → source-event coordinates, and sends one atomic call to source Main. Destination window ids never route events.
DragDrop retains/exposes the exact live Mouse sensor instance; the executor reads its current delay/minDistance, and a changed-threshold positive control proves no copied literals.
Source Main dispatches mousedown on the source node, a separate live-threshold arming move, all post-arm moves and release on document.body, with steps total across the whole polyline and duration applying only post-arm.
Success requires correlated drag:start, at least one correlated drag:move, and correlated drag:end; unrelated document drags cannot satisfy the receipt.
Receipt separates raw dispatch counts from observed lifecycle counts, includes live sensor values and resolved coordinate spaces, and claims no splitter/grid/dock semantic result.
Missing target/geometry, busy sensor, short path, failed dispatch, never-armed sensor, absent move, missing terminal, or failed cleanup returns success:false with the exact phase, partial receipt, and cleanup status.
A source node removed after arming does not block later moves/release because the stable document-body carrier owns them.
simulateEvent() preserves its Boolean surface, runs the full supplied sequence, and returns false when any dispatch failed; a mixed-success test proves a later mouseup still runs.
Focused units cover request modes/geometry, sensor authority, lifecycle correlation, concurrency, path scheduling, cleanup, and Client routing.
The Engine whitebox fixture exposes raw app.driveDrag(request) routing without depending on Brain #204 or duplicating the gesture recipe.
A live same-window Splitter witness proves physical actuation and a separate width/commit postcondition; a two-window Neural Link witness proves target-local → screen → source-event coordinate routing without coupling to dock-transfer semantics.
learn/guides/testing/WhiteboxE2E.md documents simulateEvent (raw), driveDrag (whole atomic gesture), and page.mouse (held/mid-gesture intervention) without claiming one replaces the others.
Brain #204 remains blocked until this Engine contract merges; it consumes the typed failure envelope and owns MCP error conversion.
Out of Scope
The Brain MCP/OpenAPI tool; that is a separate neo-agent-brain ticket blocked on this Engine capability.
DockLayouts architecture, reducer changes, splitter feature work, grid behavior, or any semantic drag outcome.
Migrating every existing manual recipe in the same PR; one reference witness is enough. Follow-up consumer cleanup must be independently justified.
Touch/pen gestures, arbitrary pointer-device abstraction, replay ledgers, new diagnostics, or a second drag engine.
Removing or deprecating simulate_event.
Avoided Traps
App-worker event loop called atomic: rejected; App resolves geometry, source Main executes/observes the one transaction.
Destination-window dispatch: rejected; the source Mouse sensor owns the whole gesture. Destination windows are geometry authorities only.
Competing client/screen inputs: rejected; target-local coordinates derive one screen point and one source-event client point.
Brain-side timing constants: rejected; the retained live Mouse instance owns arming thresholds.
Arming move counted as drag:move: rejected; threshold crossing installs the move listener only afterward.
Fail-fast simulateEvent: rejected; it can skip a caller-supplied mouseup and wedge the sensor.
Thrown custom Error receipt: rejected; current cross-worker/JSON-RPC layers drop custom data. Engine returns a typed failure envelope; Brain converts it.
Semantic-operation substitution: rejected because reducers cannot falsify pointer arming, movement, hit-testing, or release.
Bulk caller refactor: rejected to keep this one Engine primitive and one reference witness.
Semantic dock operations remain separately owned by #14587
Live latest-open sweep: checked the latest 20 open issues in both Engine and Brain plus exact drive_drag / verified-drag / simulateDrag / drag-gesture searches at 2026-08-27T21:12:11Z; no equivalent found. A2A all-status recency sweep: 30 messages; no competing Neural Link drag claim.
Context
A live Neural Link attempt to exercise a Neo splitter exposed a tooling gap: the raw event channel can dispatch the necessary mouse events, but the caller must reconstruct Neo's complete drag-arming recipe and cannot tell whether the gesture actually armed.
Live source verification on Engine
devfound:src/ai/client/InteractionService.mjs#simulateEvent()preserves event order and delays, but discards every Boolean returned bydispatch()and returnstrueafter the loop.src/main/addon/EventSimulator.mjs#dispatch()returnsfalsewhen the DOM target is absent or event construction/dispatch fails.src/main/draggable/sensor/Mouse.mjsowns the physical gesture contract: the live delay and minimum-distance thresholds,drag:start,drag:move,drag:end, and lost-release cleanup.mousedown/ delayedmousemove/mouseuprecipes themselves: Workstation, the cross-window dashboard example, and two whitebox journeys.The history is consistent. Engine issue 12884 explicitly left a
simulateDragconvenience primitive out of scope. Engine issue 12807 established the raw Mouse-sensor recipe without adding that primitive. Engine issue 14772 later proved a real cross-window gesture throughsimulateEvent, but embedded the choreography in a product consumer. Engine issue 16365 demonstrated why event arrival is not equivalent to an armed drag.The Problem
simulate_eventis a useful low-level escape hatch, not a gesture transaction:false;drag:start, processed movement, or reacheddrag:end;The missing Engine capability is one atomic, truthful drag execution primitive that the Brain can expose without knowing DOM or sensor internals.
The Architectural Reality
InteractionServiceowns JSON-contract validation plus live cross-window geometry; source-window MainEventSimulatorowns the one atomic native transaction.WindowManager.innerRect, then derives the source-eventclientX/Yseparately.DragDropalready creates the one live Mouse sensor per Main realm but discards its handle. It must retain/expose that exact instance so execution reads current per-instancedelay/minDistancevalues; class defaults are not runtime authority.mousedown/mousemove/mouseup; it never callsstartDrag()orendGesture()on the success path.drag:start,drag:move, anddrag:endto the exact native MouseEvent objects constructed by this transaction. Counting an unrelated concurrent drag is forbidden.success:falseinto an MCP tool error.simulate_eventremains the raw escape hatch. It executes the full caller-supplied sequence and accumulates dispatch success; it must never return early and skip a later cleanup event..mjsplacement is required: extend the existing Client, InteractionService, EventSimulator, DragDrop, and existing test surfaces.The Fix
Add
InteractionService#driveDrag(), register Engine RPCdrive_drag, and extend the existing Main-thread owners without creating a second drag engine.The request is JSON-first:
{ source: { targetId: 'required DOM id', windowId: 'required source window id', anchor : {x: 0.5, y: 0.5} // optional normalized point, each axis in [0,1] }, destination: { // Exactly one mode: targetId: 'target DOM id', windowId: 'target window id', anchor: {x: 0.5, y: 0.5} // OR target-local point; screen coordinates are derived, never caller-competed: windowId: 'target window id', clientX: 240, clientY: 180 // OR source-relative delta: deltaX: 120, deltaY: 0 }, waypoints : [], // optional node or target-local point descriptors; no delta waypoints steps : 8, // post-arm traversal moves across the WHOLE polyline; integer 1..120 durationMs: 160 // post-arm traversal duration; >= steps * 16 and <= 30000 }When
durationMsis omitted, Engine derivesmax(160, steps * 20). This duration begins after arming. Source Main always waits the live Mouse-sensor delay, then dispatches one separate arming move beyond the live minimum distance. The requested path must itself reach that threshold; a short path fails atarmingrather than silently overshooting into another drop zone. The threshold-crossing move emitsdrag:start;stepscounts later post-arm moves, so at least one observeddrag:moveremains possible.InteractionService resolves every node/point immediately before the call:
DomAccess#getBoundingClientRectin that node's own window;innerRectproduce the canonical screen point;innerRectproduces the MouseEvent's source-realmclientX/Y;resolution.It then sends one remote
EventSimulator.driveDrag()call tosource.windowId. Mousedown targets the source node. Every later move, terminal up, and best-effort cleanup up dispatches ondocument.bodyin the source window so source-node replacement cannot strand the Mouse sensor.Main refuses a second executor while one transaction is active or the live Mouse sensor is already engaged. It correlates lifecycle events by
event.detail.originalEventidentity against the native events this transaction constructed.Every RPC returns one envelope. Success:
{ success: true, phase : 'complete', sensor : {delayMs, minDistance}, dispatch: {down: true, moveCount: 9, up: true}, observed: {started: true, moveCount: 8, ended: true}, released: true, // means correlated drag:end observed cleanup : {attempted: false, succeeded: true}, source, destination }Failure returns the same receipt fields with
success:false, one exact phase (resolution|busy|arming|dispatch|movement|release|cleanup), anderror:{code,message}.dispatch.moveCountcounts raw synthetic moves;observed.moveCountcounts correlateddrag:movelifecycle events. Cleanup cannot turn a failed phase into green.simulateEvent()keeps its Boolean API but executes every event in order, including delays and cleanup events, and returnstrueonly when every delegated dispatch returned true.The Engine test fixture gains a test-only
app.driveDrag(request)wrapper which calls the raw Engine RPC through the existing Neural Link connection. It does not wait for Brain #204's public MCP service. The public Whitebox E2E guide gains the narrow distinction:simulateEventremains raw sequence control,driveDragowns complete atomic gestures, andpage.mouseremains the right tool when a test must hold or intervene mid-gesture.Contract Ledger
drive_dragInteractionService#driveDrag()Neo.Main.getWindowData;WindowManager.calculateGeometry;DomAccess#getBoundingClientRectresolutionfailure envelope for ambiguity, absent geometry, non-finite/zero BCR, invalid anchor/boundsEventSimulator#driveDrag()DragDropcreates the instance; Mouse reactive configsdelay/minDistanceNeo.Main.getWindowData+WindowManager.calculateGeometry+ BCRdrag:*eventsdrag:end; no semantic app outcomesuccess:falseresult with partial receipt and cleanup statussimulateEvent()test/playwright/fixtures.mjsexisting raw-call wrapperapp.driveDrag(request)over Engine RPC before Brain #204 landslearn/guides/testing/WhiteboxE2E.mdcurrent drag guidancepage.mouseuse casessuccess:falseinto an MCP tool error without reimplementing gesture semanticsDecision Record impact
aligned-with ADR 0020 §3— Neural Link remains the Brain/Body bridge; browser interaction semantics stay Engine-side.Acceptance Criteria
drive_dragis registered in the Engine client and accepts the exact source plus discriminated node / target-local-point / source-delta contract above; anchors, bounds, finite coordinates, and one-mode-only rules fail closed.drag:start, at least one correlateddrag:move, and correlateddrag:end; unrelated document drags cannot satisfy the receipt.success:falsewith the exact phase, partial receipt, and cleanup status.simulateEvent()preserves its Boolean surface, runs the full supplied sequence, and returns false when any dispatch failed; a mixed-success test proves a later mouseup still runs.app.driveDrag(request)routing without depending on Brain #204 or duplicating the gesture recipe.learn/guides/testing/WhiteboxE2E.mddocumentssimulateEvent(raw),driveDrag(whole atomic gesture), andpage.mouse(held/mid-gesture intervention) without claiming one replaces the others.Out of Scope
neo-agent-brainticket blocked on this Engine capability.simulate_event.Avoided Traps
Related
Live latest-open sweep: checked the latest 20 open issues in both Engine and Brain plus exact
drive_drag/ verified-drag /simulateDrag/ drag-gesture searches at2026-08-27T21:12:11Z; no equivalent found. A2A all-status recency sweep: 30 messages; no competing Neural Link drag claim.Origin Session ID:
db682c7c-7b7a-4e42-8374-71944a42db40Retrieval Hint: "Neural Link drive_drag atomic Engine InteractionService truthful drag receipt Mouse sensor arming"