Skip to content

Persona eyes live end-to-end + media substrate + web-dev bench scoring (#187/#29/#123) - #1953

Merged
joelteply merged 12 commits into
canaryfrom
feat/perception-eyes-media-bench
Jul 18, 2026
Merged

joelteply merged 12 commits into
canaryfrom
feat/perception-eyes-media-bench

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

This session's arc, cherry-picked clean onto canary (12 commits, 34 files) — the base perception package was already integrated via #1952; this is everything on top of it.

Persona eyes — LIVE end-to-end (#187 / #29)

  • perception/observe — SEE (pixels) + REASON (element tree) as one persona-callable Provided command.
  • Core→client provider back-channel (ipc/provider_bridge.rs): the headless core forwards a persona's Provided call to a connected eye-node (provideCall/provideResult, core-owned correlation, 120s fail-loud — never a fabricated observation).
  • NodeSocketTransport (sdk/typescript) — the Fix CI workflow with ESM compatibility and .continuum paths #29 serve-layer over the IPC socket (provide+flush).
  • apps/eye-node — opt-in Node worker; fulfils perception/observe by driving real Chromium via @continuum/perception.
  • Glass-boxed live: cu perception/observe --target https://example.com → core → registry → eye-node → real Chromium → back (real PNG + DOM tree); full lifecycle incl. fail-loud when no eye-node is connected.

Dispatch-path purity fix

The socket route (route_command: cu/IPC/MCP) bypassed the interceptor chain, so a Provided command reached the eye-node on the persona route but not the socket. Unified via ONE route_provided() both paths call + ONE Runtime-owned ProviderRegistry. Regression test pins the socket route reaching a bound provider. (commands/tools/MCP all through the same infra.)

Web-dev bench scoring (#187 / #123)

UiCheck → score_observation → grade_ui — the structural diff on the element tree = the money signal. Works for every persona (scores structure, which any model reads — no VLM required). Pure + tested. The cognition/eval runner arm is the next slice.

Media substrate — compute-once, share-many (hardware-grade)

  • media/image_ops.rs — canvas scale/crop primitive (on the image crate).
  • media/frame.rs — MediaFrame: content-hash identity; derivatives compute-once & share zero-copy on SharedCompute (the CBAR VideoFrame); cross-persona dedup + eager mip prefetch proven.

Also

  • sdk_codegen: atomic SDK vendoring — a stale protocol binding no longer deletes the committed wire/ tree.

All commits validated (cargo test + tsc); the cherry-picked tree compiles clean against canary.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

joelteply and others added 12 commits July 18, 2026 14:08
The finishing seam of the Perception Surface brick: a persona can now call
`perception/observe` and get back SEE (pixels) AND REASON (the structure tree
it aims actions at) — the enriched sibling of `interface/screenshot` (SEE-only).

Mirrors the `interface` module exactly: a pure-CommandSpec `Provided` command
(one NAME, N platform adapters). The headless core CANNOT observe — no browser,
no renderer, no display on a rack instance — so it ROUTES the call to whichever
connected node holds an eye, fulfilled by the `@continuum/perception` Surface
(DomSurface today, SceneSurface/BevySurface next). No adapter → fails loud,
never a fabricated observation.

- `core/continuum-core/src/perception/mod.rs` — ObserveParams/ObserveResult +
  recursive ProbeNode/ProbeBox/ObservedImage/ObserveViewport as ts-rs wire types
  (single source of truth, generated into protocol/typescript/perception/). BARE
  wire shape: the adapter, not a ServiceModule, produces the result.
- AiSafe → auto-joins every persona's tool surface; added to the native set
  beside interface/screenshot so a persona is offered its eyes every turn.
- Regression test pins it as AiSafe + Provided + native (Provided commands fail
  closed, so a silent drop would blind personas — caught loudly).

Validated: cargo check (metal,accelerate) clean; ts-rs bindings generated;
persona_tools + sdk_codegen registry tests green; registration test green.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
… to an eye-node (#187)

The Rust half of "literally ask a persona what it can see". Before this, a persona
calling perception/observe OR interface/screenshot fell through to command_executor
case 4 ("no Rust module handles command") — correct fail-loud, but blind to the real
shape: a Provided command needs a connected ADAPTER, not a substrate module.

- ProviderRegistry — connected providers keyed by exact command name; the IPC
  connection layer registers an eye-node's provider on connect, drops it on
  disconnect. Shared Arc between that writer and the interceptor reader.
- ProvidedCommandProvider trait — a connected adapter (browser/renderer/VR
  framebuffer) that fulfills bare Params → bare Result; owns its own success/error.
- ProvidedCommandInterceptor — tail of the chain [airc, grid, provided]: airc/grid
  get first look (an explicitly remote-targeted observe still hops to a peer's eye);
  otherwise a Provided command routes to its connected provider, or fails loud NAMING
  the missing eye-node; a non-Provided command declines so local dispatch is unchanged.
- Wired at boot (ipc/mod.rs) with an empty registry: perception/observe +
  interface/screenshot now fail loud honestly ("connect an eye-node") instead of the
  generic "no Rust module handles command". The eye-node CLIENT that populates the
  registry rides task #29 (new client SDK) — that's the next slice.

Validated: cargo check clean; 4 seam tests (forward to provider / fail-loud with no
provider / decline non-Provided / provided-set is the real registry slice); 33
command_executor + 5 interceptor-chain tests still green (interceptor only wires in
the live boot path, so no unit executor inherits it).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…lfil a persona's Provided command (#187/#29)

The socket IPC was strictly client→core request / core→client response, so a
Provided command (perception/observe, interface/screenshot) had no path: the
headless core can't render/capture, and there was no way to call BACK into a
connected client that holds the eye. This adds the missing half.

- ipc/provider_bridge.rs: IpcClientProvider (impl ProvidedCommandProvider) whose
  fulfill pushes a `provideCall` frame down the connection's writer thread and
  awaits the client's `provideResult` via a core-owned correlation map (next_id +
  pending), with a 120s timeout that fails loud — never a fabricated observation.
  register_provider handles the `provider/register` handshake (rejects any
  non-Provided command loud); complete_provide_result routes replies by callId.
- ipc/mod.rs: Outbound enum (Response | ProvideCall) as the one writer-channel
  item so responses + core-initiated calls stay frame-atomic; send_provide_call_
  frame; reader-loop discriminators for `provideResult` (complete oneshot) and
  `provider/register` (inline — needs per-connection tx + correlation state no
  ServiceModule can see); hoisted the ONE ProviderRegistry shared by the
  interceptor (reader) and ServerState (connection layer); disconnect cleanup
  unregisters pointer-matched (never evicts a newer eye-node).
- runtime/provided_provider.rs: unregister_matching (ptr-identity) for safe
  disconnect.

Registry still empty until an eye-node client connects (next chunk, #29) — so
perception/observe + interface/screenshot fail loud honestly, not silently.

9 tests green (5 provider_bridge back-channel + register + 4 provided_provider);
65 ipc framing + perception observe tests still green; cargo check clean.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…longer deletes the committed wire tree

The TS-SDK emitter did `remove_dir_all(wire/)` FIRST, then copied the
transitive wire-type closure — so a missing/renamed `protocol/typescript`
binding (e.g. a command whose Params derives TS but lacks `#[ts(export)]`)
failed mid-copy AFTER the committed `sdk/typescript/generated/wire/` tree was
already deleted, forcing a manual `git checkout` to recover. Re-running the
generator on a stale checkout trashed the repo.

Now: vendor into a `.wire.staging` dir, and only swap it into `wire/`
(remove + rename) once the WHOLE closure copied successfully. A missing
binding fails loud with the committed tree untouched and no staging leak —
the generator is safe to re-run on any checkout.

Verified: on this checkout (BenchmarkList* derive TS but aren't exported)
the generator still fails loud, but `git status` shows the committed wire
tree unchanged and no `.wire.staging` left behind. Follow-up (task #80):
add `#[ts(export)]` to the benchmark command types so the SDK regen succeeds.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…C socket (provide + provideCall back-channel)

The WebSocketTransport dispatches Command frames only; provide() throws. The
eye-node needs the SERVE side: a client the core routes Provided commands back
to. NodeSocketTransport is that binding over the Unix/TCP IPC socket, speaking
the Rust IPC wire (newline-delimited requests out, length-prefixed frames in)
and the new provider back-channel:

- execute(): frames `{command, ...params, requestId}` (matching the Rust reader's
  top-level param spread), correlates the length-prefixed reply.
- provide() + flush(): registers handlers and sends `provider/register`; a
  core `provideCall` frame is dispatched to the handler and answered with a
  `provideResult` — the eye-node fulfilling perception/observe.
- emit/subscribe fail loud (later #29 layers); session() is honestly empty.

Runtime-agnostic like WebSocketTransport: the socket is injected
(SocketConnector), framing uses Uint8Array/DataView/TextDecoder — no hard
net/Buffer import, so the SDK stays standalone.

5 vitest cases (call+correlate, error-reject, register→dispatch→provideResult,
throwing-handler→fail-loud, no-handler→fail-loud) green; tsc --noEmit clean.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…tion/observe over a real browser (#187/#29)

apps/eye-node: an opt-in, browser-capable Node worker. Connects to the core IPC
socket, registers as the provider of perception/observe (via the SDK's
NodeSocketTransport), and fulfils each call by driving @continuum/perception's
PerceptionSession over a real Chromium.

- observeAdapter: ObserveParams → PerceptionSession.openWeb(target) → observe() →
  bare ObserveResult (image data-URL + structure tree + url/title). Never throws
  — an adapter failure returns { success:false, error }, the honest bare contract
  (never a fabricated observation). Wire types single-sourced from Rust
  (protocol/typescript/perception); internal surface types from @continuum/perception.
- eyeNode/index: connect, provide('perception/observe'), flush, stay alive; SIGINT
  clean disconnect (core then unregisters → observe fails loud until reconnect).

`target` is uniform — continuum's own UI, a persona's project dev server, a
benchmark, a room/recipe route are all just URLs to open. Opt-in per the
browserless-core principle: a browser-capable node runs one; a rack instance
doesn't.

tsc --noEmit clean. Added to root workspaces + linked.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…cket route reaches the eye-node too

Glass-boxing perception/observe via `cu` surfaced a purity break: the socket
route (`route_command`, used by cu / IPC / MCP) mirrored `route_object` but NOT
the CommandExecutor's interceptor chain — so a Provided command reached the
provider seam on the in-process persona route but fell through to "Unknown
command" on the socket route. One command existing on one path and not another
is exactly the divergence that let benchmarks take a different command path.

Unified through ONE decision, called by BOTH paths and nothing else:
- `provided_provider::route_provided(registry, command, params)` — the single
  place a Provided command is forwarded to its connected provider or failed loud.
  `provided_command_names()` is the single "is this Provided?" set.
- `ProvidedCommandInterceptor::try_route` now just delegates to it (dropped its
  private duplicate set + inline fulfil logic).
- `Runtime` OWNS the `ProviderRegistry`; `route_command` consults `route_provided`
  before falling through to module dispatch. The IPC layer takes
  `runtime.provider_registry()` — one registry the interceptor, the connection
  layer (eye-node register), and the socket route all share.

So cu / MCP / jtag / a persona's hands all reach the eye-node by the same
infrastructure; none gains or lacks the capability. Regression test pins the
socket route forwarding to a bound provider + failing loud with none. 73 provider
tests green.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…'s money signal (#187/#123)

`score_observation(&ObserveResult, &[UiCheck]) -> UiScore`: the deterministic
"diff on the element tree" that turns an observation into a number. A UiCheck is
a structural criterion (tag / role / text-contains / min-count); the score is the
fraction met, with a per-check breakdown for the scorecard.

The SAME UiScore is three things (Perception Surface thesis): a persona's "did my
change render right?" self-check, the training label for perceive→act→diff
capture, and the functional web-dev benchmark score a Grader will call. It scores
the STRUCTURE tree (text every model reads), so a non-visual local model competes
on the same rendered-UI facts as a VLM — no persona is design-blind by base model.

Pure + deterministic (no browser, no persona, no serving, budget-neutral). ts-rs
wire types (UiCheck/UiCheckResult/UiScore) so a web-dev gym task authors its spec
as data. 4 logic tests (met=1.0, partial credit, failed-render=0, empty-spec=0)
+ 3 binding tests green.

Next slice: a web-dev gym + a Grader::Perception that serves the persona's output
(file://), observes via an eye-node, and scores here — wired INTO cognition/eval,
the same benchmark path (no parallel arena).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…e shared media substrate (#187)

The one image-dimension transform every scaled cell / mip level is built from:
`scale_crop(src, crop, dest)` = HTML canvas drawImage(sx,sy,sw,sh → dw,dh) —
optionally crop the source rect, resize (Lanczos3), re-encode PNG. On the
standard `image` crate (already a dep), no reinvent.

Pure + deterministic (bytes→bytes, no cache, no I/O) so it runs ONCE per
(content-hash, spec) and the result is cached + Arc-shared thereafter — a
thumbnail is just dest=standard-size; a mip chain is a sequence of these. Fails
loud on undecodable bytes / zero dest / out-of-bounds crop (never silently clamps).

`media/` is the home for the efficient media substrate (docs in mod.rs): a media
artifact is a CBAR VideoFrame — one source keyed by content hash whose derivatives
(scaled sizes, YOLO/semseg/OCR aids, description, embedding/KV, audio transcription)
are computed once via the existing `SharedCompute` (the runtime's CBAR_VideoFrame
analog) and shared zero-copy across every persona; per-persona projection SELECTS
the right cell by capability (by ref), never recomputes, never clamps.

5 tests green (scale, crop-then-scale, + 3 fail-loud).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…once & share zero-copy on SharedCompute (#187)

A media artifact as a CBAR VideoFrame: `MediaFrame::from_bytes` addresses the
source by sha256, and derivatives are cached on `SharedCompute` (the runtime's
CBAR_VideoFrame analog) under the content-hash SCOPE — so two personas looking at
the same bytes share every derivative. First cell: `scaled(compute, crop, dest)`
computes the scale/crop once per (content, crop, dest) and returns the SAME Arc to
every caller (zero-copy). Deep cells (YOLO/semseg/description/vision-KV, audio
transcription) attach identically — async get_or_compute on the same scope, so
they enrich without stalling the turn (fast/deep bridge, #168/#171).

`compute` is passed by reference so the frame shares the ONE cache the caller
owns — no per-frame silo, no clamp (the derive-not-clamp / structs-by-ref
discipline). Deterministic transform ⇒ caching Err is correct.

3 tests: content-addressing, compute-once/share-zero-copy (Arc::ptr_eq), and
cross-handle dedup (13-viewers-share-one-transform). The tiered mem→disk eviction
(governed ResourceConsumer) + eager mip prefetch attach to this next.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…s/fail threshold) (#187/#123)

`grade_ui(&observation, &checks, pass_threshold) -> UiGrade{passed, score, summary}`
— scores the observation and thresholds the fraction to the eval runner's binary
(ok, grade) seam, with the fractional score riding along. A met spec passes at
1.0; a half-met spec fails at 1.0 but passes at 0.5; a failed/empty render never
passes. Lives OUTSIDE cognition so the eventual cognition/eval grading arm is a
one-liner (grade_ui(...) → (g.passed, g.summary)) and the STOP-zone edit stays
trivial. ts-rs UiGrade binding. 3 tests + binding green.

The eval-runner wiring (a checks field on EvalTask + a perception_grade arm in the
eval.rs if/else chain that serves the persona's built files file:// to the
eye-node) is the deliberate next slice — it's in the cognition STOP-zone with one
untraced path (Ctx-less perception/observe invocation), the exact place NOT to rush.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…ells (#187)

"If we know we'll need it, do it ahead of time, once, not on the hot path."
prefetch(compute, sizes) warms a set of scaled cells CONCURRENTLY (futures
join_all) so later reads are cache hits — the fast lane for a frame about to be
shown (a room opening media, a bench about to score a UI). Idempotent
(compute-once): re-warming an already-cached cell is free. Test proves the cells
are in the cache (key_count) after prefetch, before any hot-path read.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply
joelteply merged commit 3e6561c into canary Jul 18, 2026
3 of 4 checks passed
@joelteply
joelteply deleted the feat/perception-eyes-media-bench branch July 18, 2026 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant