implement real headless process gateway and supervision

This commit is contained in:
2026-09-29 11:02:21 +01:00
parent 9592c9b274
commit bc76f08bbd
13 changed files with 771 additions and 5 deletions
@@ -203,6 +203,14 @@ mandatory capability MUST block the session; compatible minor additions are
permitted. It MUST obey complete UTF-8 JSONL framing and separate protocol
stdout from stderr diagnostics. Invalid input/schema MUST not disappear silently.
The application adapter resolves the executable from `ProjectLocalStudioSetup`,
launches it without a shell in the project root, and passes all six effective
limits explicitly. Hello and initialize share one handshake deadline. Required
hello limits must match the launch configuration; request IDs and session IDs
are checked on every subsequent response. Partial lines, invalid UTF-8,
duplicate JSON keys, uncorrelated replies and non-monotonic progress invalidate
the process. Stderr is drained independently into bounded diagnostics.
The runtime-owned surface covers boot/reset, set/clear normalized input,
advance, capture, state/fault, cancel and shutdown. Conflicting execution work
MUST NOT execute concurrently or be silently queued. Advance MUST preserve
@@ -210,6 +218,10 @@ requested/completed counts and stop reasons. Cancellation is observed between
frames; the current frame retains its deterministic watchdog, not a wall-clock
guest deadline. No background realtime game loop is introduced for automation.
Reset leaves the runtime unbooted and clears its capture. It does not implicitly
boot the cartridge again. A subsequent explicit boot may reuse the session's
known build cartridge; an invalidated process requires an explicit new session.
| Configurable, handshake-advertised limit | Default |
| --- | --- |
| Frames per advance | 600 |
@@ -229,9 +241,16 @@ Screenshot means the runtime's canonical **RGBA8888 framebuffer bitmap**.
Capture MUST use lossless PNG/base64 with dimensions, original stride/layout,
runtime session, `logical_frame_index` and `FrameId`. These two frame identities
MUST NOT be assumed numerically equal. Studio MUST attach build correlation.
Both identities retain the full unsigned 64-bit range: Java uses `BigInteger`,
and MCP serializes integer JSON values without conversion through floating point.
Hashes MAY supplement but MUST NOT replace pixels. No desktop/window screenshot,
temporary-image-file transport or continuous video is permitted.
The adapter validates base64, PNG signature, RGBA8 header, dimensions and decoded
image consistency in memory, then forwards the original PNG bytes unchanged.
Its decoder currently guards allocations at 16,777,216 pixels; exceeding this
bound fails explicitly rather than resizing or substituting the image.
Agent and DEV MUST receive the same capture and correlation for requested
advances. DEV MUST identify images from an older build/session as stale during
edits/rebuilds. The previous execution MUST stop before rebuilding artifacts