Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
146 commits
Select commit Hold shift + click to select a range
5c4645f
feat(cua): define self-window driver and surface contracts
sjungwon03 Nov 24, 2026
a1369cb
feat(agent): define CUA approval presentation contract
sjungwon03 Nov 24, 2026
610d1bf
Merge commit '5c4645f0a0a6b45b6c525e0b9c122795b332222e' into feat/559…
sjungwon03 Nov 24, 2026
ee7a24f
feat(cua): report renderer execution block independently of layout
sjungwon03 Nov 24, 2026
63eac3a
feat(cua): add scoped input driver and release lifecycle
sjungwon03 Nov 24, 2026
8294d27
test(cua): cover sender safety and document native input probes
sjungwon03 Nov 24, 2026
cf11d74
feat(cua): define bounded drag rollback acknowledgement
sjungwon03 Nov 24, 2026
7291355
feat(agent): orchestrate one-use CUA approval and settled cancellation
sjungwon03 Nov 24, 2026
f0b9b7f
Merge commit 'cf11d74dfc8d1adfa1f08b5d9e7372db27c73785' into feat/559…
sjungwon03 Nov 24, 2026
8d7dd2a
feat(cua): await bounded rollback before releasing drag input
sjungwon03 Nov 24, 2026
6da15bc
Merge remote-tracking branch 'origin/feat/559-approved-self-window-cu…
sjungwon03 Nov 24, 2026
807d271
Merge remote-tracking branch 'origin/feat/558-app-window-cua-driver' …
sjungwon03 Nov 24, 2026
3b9cd4e
fix(agent): align cancellation state and test observed CUA approval
sjungwon03 Nov 24, 2026
1444d84
feat(cua): wire trusted approval runtime and verify document safety
sjungwon03 Nov 24, 2026
7961ac1
Merge remote-tracking branch 'origin/feat/559-approved-self-window-cu…
sjungwon03 Nov 24, 2026
58a25f4
fix(agent): enforce CUA per-call policy and rollback settlement locks
sjungwon03 Nov 24, 2026
7bde903
fix(cua): scale CSS input by measured Electron zoom
sjungwon03 Nov 24, 2026
19a4c64
Merge remote-tracking branch 'origin/feat/559-approved-self-window-cu…
sjungwon03 Nov 24, 2026
bbf8835
fix(cua): refuse iframe and webview input targets
sjungwon03 Nov 24, 2026
901f534
Merge commit '7bde903bb97b1047910a430e37bdcba324698b67' into feat/559…
sjungwon03 Nov 24, 2026
be42093
Merge commit 'bbf88354b66379e01cac27cb3a715db9f10a9d08' into feat/559…
sjungwon03 Nov 24, 2026
c03f32c
test(cua): verify pending panel exceptions and serialize capture
sjungwon03 Nov 24, 2026
5e035f0
test(cua): record isolated initial-focus probe limitations
sjungwon03 Nov 24, 2026
2a7edd7
fix(cua): revoke ready runs on invalid or changed safety reports
sjungwon03 Nov 24, 2026
310eb0a
Merge commit '2a7edd741993ab2f59cc15a137e546a1851fe3f2' into feat/559…
sjungwon03 Nov 24, 2026
03fc2b0
feat(cua): implement virtual cursor overlay, surface snapshots, and p…
sjungwon03 Nov 24, 2026
73a39de
feat(cua): add sync drag rollback cancelAck, executionBlocked, and ap…
sjungwon03 Nov 24, 2026
339b12b
test(agent): add isolated real-app CUA approval harness
sjungwon03 Nov 24, 2026
4fe9332
fix(cua): keep fixed-footprint stop button mounted and intra-safe foc…
sjungwon03 Nov 24, 2026
c44540f
feat(agent): validate CUA permits without consuming preflight authority
sjungwon03 Nov 24, 2026
bbab421
fix(agent): reject mixed CUA tool steps before all side effects
sjungwon03 Nov 24, 2026
fdbcb22
feat(cua): expose explicit Save button in safe timeline surface and d…
sjungwon03 Nov 24, 2026
bb6a971
fix(agent): keep completed CUA input separate from later observation
sjungwon03 Nov 24, 2026
00a69a4
fix(agent): require CUA content revision in action schema
sjungwon03 Nov 24, 2026
a900bee
fix(cua): remove timeline-save-btn from safe surface and keep protect…
sjungwon03 Nov 24, 2026
3d66330
feat(cua): prepare approved input and bind content revisions
sjungwon03 Nov 24, 2026
c009af4
Merge commit '00a69a42b858ffc1a62a6072bec2ef5222ca19f3' into feat/558…
sjungwon03 Nov 24, 2026
51469f2
fix(agent): await release when graph abort precedes tool settlement
sjungwon03 Nov 24, 2026
adafb4a
Merge commit 'a900bee19e93a97cd4226617209f03935c2f3977' into feat/559…
sjungwon03 Nov 24, 2026
1b4d6af
Merge commit 'c009af482812f26eb9aaa5da38f1e1814ebdf81f' into feat/559…
sjungwon03 Nov 24, 2026
99fda74
Merge commit 'c009af482812f26eb9aaa5da38f1e1814ebdf81f' into feat/558…
sjungwon03 Nov 24, 2026
bb975e8
fix(agent): bind CUA approvals to required content revisions
sjungwon03 Nov 24, 2026
49acb78
feat(agent): expose trusted observation in-flight query
sjungwon03 Nov 24, 2026
e0c31aa
feat(cua): define explicit live timeline save handshake
sjungwon03 Nov 24, 2026
e3716f1
Merge commit 'e0c31aa275f27835897a28fc22cd6cd21f878724' into feat/559…
sjungwon03 Nov 24, 2026
bf96edc
feat(cua): implement preparing/cuaAckPrepare handshake and contentRev…
sjungwon03 Nov 24, 2026
73855b8
feat(cua): persist only approved immutable editor snapshots
sjungwon03 Nov 24, 2026
dea1844
feat(agent): define isolated Save permits and approval summaries
sjungwon03 Nov 24, 2026
946557e
Merge commit '49acb7808ac8c33705016bd6364afe9db3a16662' into feat/558…
sjungwon03 Nov 24, 2026
c26a3db
Merge commit '73855b8695365136ebe881349e85e06e57c07474' into feat/559…
sjungwon03 Nov 24, 2026
66e87ae
fix(cua): verify trusted busy cause before readonly capture
sjungwon03 Nov 24, 2026
1f27745
fix(cua): keep legacy renderer blocked without content tracking
sjungwon03 Nov 24, 2026
3d6ade4
feat(agent): dispatch separately approved live-editor Save snapshots
sjungwon03 Nov 24, 2026
0d22263
fix(agent): arbitrate CUA approval and await every cleanup settlement
sjungwon03 Nov 24, 2026
6542ef0
fix(cua): preserve close failures and bound save snapshot retention
sjungwon03 Nov 24, 2026
53ec135
Merge commit '3d6ade4d52733efed80132df80ff718a97af7c49' into feat/558…
sjungwon03 Nov 24, 2026
b62202c
Merge commit '1f27745216a18ad9705f6a0c5d27d8edf82a21a1' into feat/559…
sjungwon03 Nov 24, 2026
3d0c7e9
Merge commit '0d22263e2148a8c4fd26d59620966789858d3ed8' into feat/558…
sjungwon03 Nov 24, 2026
0d83f9f
fix(agent): explain the three explicit Save error outcomes
sjungwon03 Nov 24, 2026
d7b1213
feat(cua): wire explicit approved saves into the main lifecycle
sjungwon03 Nov 24, 2026
912f26d
Merge commit '0d83f9faea9831f02e3f217a586548e58eeafc5e' into feat/558…
sjungwon03 Nov 24, 2026
6565644
fix(agent): skip legacy autosave for exact CUA approvals
sjungwon03 Nov 24, 2026
ca3fdbf
fix(cua): keep filesystem details out of save receipts
sjungwon03 Nov 24, 2026
20d6137
fix(agent): reserve approval gate throughout Save snapshot preparation
sjungwon03 Nov 24, 2026
04be504
Merge commit '912f26dac34153cf4b296cccb53307212dfe66a3' into feat/559…
sjungwon03 Nov 24, 2026
69da1be
Merge commit '6565644e21d94adc94b457a6e4213e0bc395784c' into feat/558…
sjungwon03 Nov 24, 2026
8ef8beb
fix(agent): discard inactive denied Save proposals
sjungwon03 Nov 24, 2026
37f61ee
fix(cua): map tested Electron arrow key codes
sjungwon03 Nov 24, 2026
2bf24be
fix(cua): invalidate scope on stale renderer telemetry
sjungwon03 Nov 24, 2026
a8557f6
Merge commit '8ef8bebe1804d1885fa04651b762029c6f9e2ff7' into feat/558…
sjungwon03 Nov 24, 2026
1e56ded
feat(agent): require explicit Window CUA mode without implicit saves
sjungwon03 Nov 24, 2026
554000d
test(cua): validate publication expiry and bounded surface data
sjungwon03 Nov 24, 2026
fd640ec
Merge commit '1e56dedda01780d47f6cacdfa983c28b5cb1eb26' into feat/558…
sjungwon03 Nov 24, 2026
e604fe1
test(agent): measure dirty first-send writes and native Undo separately
sjungwon03 Nov 24, 2026
1ae929b
Merge commit 'fd640ec1f71690c122ff9d2f9d753ce2cafd5aec' into feat/559…
sjungwon03 Nov 24, 2026
a78e429
test(agent): record real dirty-mode send without legacy saving
sjungwon03 Nov 24, 2026
9182ebb
fix(cua): restrict save errors to exact public codes
sjungwon03 Nov 24, 2026
2a01427
test(cua): cover approved save and dirty first-turn scenarios
sjungwon03 Nov 24, 2026
6c52087
Merge commit '9182ebbfe5a571642d13747e2800926f860f0f5b' into feat/559…
sjungwon03 Nov 24, 2026
b417382
docs(cua): prepare coordinated final-app validation handoff
sjungwon03 Nov 24, 2026
eb38947
feat(cua): expose main-only input and frame diagnostics
sjungwon03 Nov 24, 2026
43b6d24
feat(jev): add secure fixed credential and lazy runtime contracts
sjungwon03 Nov 24, 2026
a4fe3cc
feat(agent): add optional pinned Jev observation advisory
sjungwon03 Nov 24, 2026
90ae98f
feat(cua): guard observation transport with main lease
sjungwon03 Nov 24, 2026
305cee5
test(jev): verify fixed-slot persistence and clear after reload
sjungwon03 Nov 24, 2026
d55624d
Merge commit '43b6d24f87401164360b20d3d357eacbd5f451cf' into feat/558…
sjungwon03 Nov 24, 2026
f4f3563
test(agent): verify Jev observation contact and fallback
sjungwon03 Nov 24, 2026
60cff26
Merge commit '90ae98fd81ad84e4e32fa2652547cbcafc6f0367' into feat/563…
sjungwon03 Nov 24, 2026
e100e28
feat(jev): wire secure credential handlers and reserve slot
sjungwon03 Nov 24, 2026
3572f4b
test(agent): verify Jev lease with native local transport
sjungwon03 Nov 24, 2026
62c9c17
feat(jev): wire secure credential handlers and reserve slot
sjungwon03 Nov 24, 2026
0f90c5e
fix(jev): reject coerced generic credential slots
sjungwon03 Nov 24, 2026
8e68c8b
feat(agent): route bounded Jev reobservation judgments
sjungwon03 Nov 24, 2026
a7522d0
fix(jev): reject coerced generic credential slots
sjungwon03 Nov 24, 2026
06ce212
feat(cua): expose read-only observation binding for judgment
sjungwon03 Nov 24, 2026
1704965
fix(agent): revalidate Jev opt-in before network awaits
sjungwon03 Nov 24, 2026
547c793
Merge commit '06ce21211de7579e078229342cdeeb5f1b1f5f16' into feat/558…
sjungwon03 Nov 24, 2026
80d5e96
Merge commit '170496548b55e7274ae142d357f2bdee8ce24893' into feat/558…
sjungwon03 Nov 24, 2026
aa94869
feat(jev): compose trusted metadata observation hook
sjungwon03 Nov 24, 2026
f3a4d3d
feat(jev): persist validated advisory config with secure IPC
sjungwon03 Nov 24, 2026
97923c5
Merge commit 'f3a4d3df0f4462d6cd91e7b57591a9f222214aff' into feat/558…
sjungwon03 Nov 24, 2026
9b10981
feat(jev): load config and register secure settings IPC
sjungwon03 Nov 24, 2026
c0b72bf
feat(jev): read persisted config in observation runtime
sjungwon03 Nov 24, 2026
a761791
feat(jev): load config and register secure settings IPC
sjungwon03 Nov 24, 2026
f911ef3
fix(jev): reconcile configuration after ambiguous write errors
sjungwon03 Nov 24, 2026
076b11d
fix(jev): confirm refreshed configuration from disk before success
sjungwon03 Nov 24, 2026
0706823
Merge commit '076b11d269ff09fcaa83606f3baafbb99b2251e3' into feat/558…
sjungwon03 Nov 24, 2026
788b15a
Merge eb38947 (CUA Save bridge & Window CUA mode) into feat/558-cua-o…
sjungwon03 Nov 24, 2026
52f1a44
Merge commit 'bf96edc1f72e9e3f9448ea74d5399159d0bb59c9' into feat/558…
sjungwon03 Nov 24, 2026
5cac09b
Merge commit 'bf96edc1f72e9e3f9448ea74d5399159d0bb59c9' into feat/559…
sjungwon03 Nov 24, 2026
73a03b0
feat(cua): wire live Save bridge, unify Stop/Escape cancel, and prese…
sjungwon03 Nov 24, 2026
e8eedb3
Merge Backend 07068237 and LLM b4173821 into feat/558-cua-overlay-ui
sjungwon03 Nov 24, 2026
98d1abe
Merge commit 'e8eedb32e0cfc74e7b6a7c4b28f983748e721511' into feat/559…
sjungwon03 Nov 24, 2026
1a6dff0
Merge commit 'e8eedb32e0cfc74e7b6a7c4b28f983748e721511' into feat/558…
sjungwon03 Nov 24, 2026
3353772
Merge remote-tracking branch 'origin/dev' into feat/558-app-window-cu…
sjungwon03 Nov 24, 2026
52dcda7
test(cua): prepare remapped shortcut publication regression
sjungwon03 Nov 24, 2026
4cf032a
fix(cua): isolate CUA shortcuts to fixed safe keymap and eliminate pr…
sjungwon03 Nov 24, 2026
6a1ff75
Merge Backend 3353772f (origin/dev sync) into feat/558-cua-overlay-ui
sjungwon03 Nov 24, 2026
a1b0588
Merge commit '6a1ff75096c49632949c5f4d08b9eb1bb78da1ca' into feat/559…
sjungwon03 Nov 24, 2026
1f38eb2
test(cua): persist remapped shortcut fixture in supported format
sjungwon03 Nov 24, 2026
abd43de
fix(cua): clip protected DOM rects to overflow ancestors
sjungwon03 Nov 25, 2026
5949ee3
fix(cua): keep stop button clickable during pendingApproval across mo…
sjungwon03 Nov 25, 2026
50ae3ff
feat(cua): define post-input settlement and dispatch receipts
sjungwon03 Nov 25, 2026
4ae56c9
fix(cua): preserve existing safe-surface DOM focus on approval button…
sjungwon03 Nov 25, 2026
3d72952
fix(cua): settle renderer commits before allowing observation
sjungwon03 Nov 25, 2026
2000a6e
Merge commit '5949ee3f68fee27faf6604f874b351858267aad4' into feat/558…
sjungwon03 Nov 25, 2026
31d36cd
Merge commit '62e93a2e987f0c72b52eed6ef8f8f8643e33f356' into feat/558…
sjungwon03 Nov 25, 2026
00aa23c
Merge commit '4ae56c9eea77db8c47f2b61d23b8db985d8faee2' into feat/558…
sjungwon03 Nov 25, 2026
597af95
test(cua): record explicit user safe return before remapped key approval
sjungwon03 Nov 25, 2026
4242f39
Merge commit '3d729529fa472e452117bcddbd9214f21ef94665' into feat/558…
sjungwon03 Nov 25, 2026
a3c90ea
Merge commit '00aa23c7e5dbe532d9cd4555616ffeb87f5563c0' into feat/559…
sjungwon03 Nov 25, 2026
687ee6b
feat(cua): implement renderer post-input action settlement attribution
sjungwon03 Nov 25, 2026
d421960
Merge commit '687ee6b89b1000121307e8e05e23d2ea5370e246' into feat/558…
sjungwon03 Nov 25, 2026
1e3d7b8
fix(cua): prevent pre-ACK external mutation laundering in action sett…
sjungwon03 Nov 25, 2026
51e78e4
Merge commit '1e3d7b851fd487fb103bbd9577c9c2a4a6611413' into feat/558…
sjungwon03 Nov 25, 2026
e3af423
test(cua): forward settlement arguments through surface spy
sjungwon03 Nov 25, 2026
9858d08
fix(cua): preserve authoritative dispatch receipts across cancelled t…
sjungwon03 Nov 25, 2026
bb64cce
Merge commit 'e3af4236fbac849c56f5f7b1d66540bd103fdb71' into feat/559…
sjungwon03 Nov 25, 2026
74bb28a
fix(cua): defer untagged attributed content report at released stage …
sjungwon03 Nov 25, 2026
e66f49a
fix(cua): defer attributed acting commit when mouseUp overtakes armed…
sjungwon03 Nov 25, 2026
da73ce1
Merge commit 'e66f49ac4e9165c046e398975142ee63e571d242' into feat/558…
sjungwon03 Nov 25, 2026
362e3fb
fix(cua): explain pending key cancellation without approval reuse
sjungwon03 Nov 25, 2026
4fa01a1
test(cua): await native menu readiness and isolate key approval scena…
sjungwon03 Nov 25, 2026
eeb18e3
test(cua): keep ordinary save fixture outside agent mode
sjungwon03 Nov 25, 2026
6878b16
test(cua): await ordinary user pointer focus delivery
sjungwon03 Nov 25, 2026
1067e14
test(cua): initialize remap fixture before editor preference mount
sjungwon03 Nov 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 105 additions & 0 deletions docs/cua-agent-validation.md

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions docs/cua-driver-validation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Self-window CUA validation

Backend item31, issue #558. Work started from clean `fdce65209afe784e92774e8c7d1fdd0daaf88e6c`.

The driver binds to the BrowserWindow supplied by the host. It neither discovers nor controls other windows, exposes a debug port, nor sends OS input. Renderer IPC exposes state, safety reporting and Stop; approval permit issuance and action execution remain main-only.

## Actual Electron API probes

Run `node_modules/.bin/electron scripts/probe-cua-input.cjs` for HTML5 drag and set `CUA_PROBE_POINTER=1` for Pointer Capture. `CUA_PROBE_DIR` selects the local evidence directory. The probe uses an isolated BrowserWindow and sends actual webContents input. It does not represent a completed editor scenario.

On this macOS host with Electron 43, HTML5 draggable receives pointerdown, mousedown, dragstart and pointercancel; subsequent sendInputEvent movements and mouseUp do not complete dragover/drop/dragend. The process also did not quit cleanly while native drag was outstanding. Therefore the existing HTML5 drag path cannot be claimed as supported by this driver.

The Pointer Capture variant receives pointerdown, every pointermove, pointerup and mouseup. Injected DOM events have `isTrusted: true`; that property cannot distinguish user input. All 27 injected mouse events reached before-mouse-event synchronously during sendInputEvent. This observation supports a synchronous delivery guard on this tested Electron/macOS version, rather than a claim of universal native input attribution.

Both initial probes reported window/content focus false even after win.focus. Actual input partially delivered regardless, so the production driver explicitly refuses unfocused input instead of relying on delivery behavior. Driver code never automatically focuses the window.

The zoom-2 probe records a CSS viewport of 350×184, PNG bitmap 700×368 and devicePixelRatio 2. Electron input (40,30) arrives at DOM CSS (20,15): input uses window DIP and must multiply CSS coordinates by zoomFactor. PNG dimensions and device display scale are measured separately; DPR alone cannot supply both conversions. `/tmp/openscene-cua-zoom-probe/input.json` and `capture.png` retain the evidence.

An explicitly authorized, initial-only test-entry selection (`CUA_PROBE_INITIAL_FOCUS=1`) called app.focus({ steal: true }), win.focus and webContents.focus with a separate temporary userData profile. On this host the resulting window ID 1, title `OpenScene CUA Input Probe`, still reported both focus flags false. `/tmp/openscene-cua-focused-isolated-probe/input.json` and `capture.png` retain this result, including all 29 injected mouse/key before-events observed synchronously inside sendInputEvent. No production focus guard was relaxed and the test never refocused mid-run. Orca's native provider reports `windows.focus: false`; its availability does not establish that this Electron window can become focused.

With `CUA_PROBE_KEYS=1`, Electron accepted `ArrowLeft/Right/Up/Down` without throwing, but the DOM received empty key strings. Electron codes `Left/Right/Up/Down` delivered the expected DOM arrow keys. The driver therefore maps logical public arrow names to these adapter codes. Delete, Backspace, Space, z and y delivered their expected keys. `/tmp/openscene-cua-key-probe/input.json` retains the accepted-code and actual DOM-event evidence. This is a native API probe, not proof of the complete application's menu/shortcut behavior.

Raw initial evidence: `/tmp/openscene-cua-probe/input.json`, `/tmp/openscene-cua-probe/capture.png`, `/tmp/openscene-cua-pointer-probe/input.json`, `/tmp/openscene-cua-pointer-probe/capture.png`. These are local experimental artifacts, not the required full application evidence.

## Remaining integration evidence

The actual OpenScene scenario (MCP clip creation, CUA selection/move, MCP state inspection, UI Undo) and mid-drag stop/rollback evidence are pending the coordinated Frontend Pointer Events implementation and LLM main approval runtime. Stop must verify renderer rollback before claiming cancellation, since a plain mouseUp can commit a pointer drag. Fresh verification, exact final SHA, CI and independent review must accompany the completed integration.

This capability is Electron desktop-specific. Mobile cannot capture/control a BrowserWindow; the shared DTO and pure coordinate conversion must still compile under the mobile TypeScript configuration.
37 changes: 37 additions & 0 deletions docs/jev-typed-judgment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Optional Jev observation judgment

Item42 / issue #563 stacks on CUA orchestration PR #561. This adapter preserves the selected chat LLM and every existing approval boundary. It is off by default. It never grants input, coordinates, approval, Save, cancellation, or credential-read authority to a model.

## Official contract verified 2026-11-24

The official [documentation index](https://docs.typesafe.ai/llms.txt) links the [quickstart](https://docs.typesafe.ai/introduction/quickstart.md), [System One endpoint](https://docs.typesafe.ai/api/system-one.md), [model listing](https://docs.typesafe.ai/api/list-models.md), [errors](https://docs.typesafe.ai/api/errors.md), [JavaScript SDK](https://docs.typesafe.ai/sdk/javascript.md), and [confidence](https://docs.typesafe.ai/confidence.md). The machine-readable [OpenAPI document](https://api.typesafe.ai/openapi.json) reports API schema version **0.2.0**; this is not a model version.

The implementation uses `POST https://api.typesafe.ai/v1/systemone` with `Authorization: Bearer <main-only key>`. The request contains `model`, `state`, named `questions`, and image `assets`; the named `judgment` question has `type: choice`, instructions, and a criteria object keyed by trusted candidate IDs. The response contains the resolved model, identically named answer, selected choice, confidence, probabilities, and token usage. `GET /v1/models` requires authentication and reports account availability; it was not called with an account during implementation.

The model pin is **jev-1.14.0**. The official [models table](https://docs.typesafe.ai/models.md) lists that exact ID with text/image input, and the [model changelog](https://docs.typesafe.ai/changelog.md) dates Jev 1.14 to October 14, 2026. Moving aliases (`jev-latest`, `jev-preview`) are deliberately not accepted as resolved responses. PNG images require `TypeSafe-Danger-Zone-Images: true`, per OpenAPI and the [image documentation](https://docs.typesafe.ai/images.md). Image transmission requires a separate main-owned `imageTransmissionAuthorized: true` context flag. By default the request contains only observation metadata and summary, with no image, assets or image header. When separately authorized, the adapter sends only the existing explicit observation image; it does not capture another frame.

The JavaScript documentation references **@typesafe-ai/sdk v0.7.0**, including its [pinned client source](https://github.com/typesafe-ai/typesafe-sdk-js/blob/v0.7.0/src/client.ts). The SDK requires Node.js 22+, with zstd compression requiring 22.15+. No SDK dependency is installed: this adapter uses the documented JSON HTTP contract and Electron main's native `fetch`, `AbortController`, and response streams, with no compression. The repository pins Electron 43.1.1; type/build and mock fetch verification do not establish a live Electron-to-TypeSafe connection. A packaged Electron runtime/live authenticated request remains unverified.

## Main-only seam

`src/main/jevObservationJudgment.ts` exports `createJevObservationHook`, `JEV_MODEL`, `DEFAULT_JEV_CONFIG`, and the DI types. Config is `{ enabled, model, minSelectedProbability, timeoutMs }`, defaulting to `{ enabled: false, model: 'jev-1.14.0', minSelectedProbability: 0.95, timeoutMs: 2500 }`. Accepted thresholds are finite numbers in `[0.5, 1]`; timeouts are integer milliseconds in `[1, 5000]`.

The main-only caller supplies `getConfig`, asynchronous `getApiKey`, and `getObservationContext(conversationId)`. The context includes trusted current frame metadata, actual held-input count, cleanup completion, the run's abort signal, a question kind, instructions, and 2–32 main-owned candidates. Kinds are `candidate-selection`, `semantic-result`, and `reobserve`. Candidates are descriptions and IDs only, with no executable input or authority.

Network also requires `acquireJudgmentLease(conversationId, frameIdentity)` to return a main-owned release handle. This is a proposed integration contract: absence or refusal means zero network and existing LLM fallback. Main must reject competing input for the entire lease, without granting a permit. The returned lease includes pinned metadata, an abort signal, owner-aware `getCurrentFrame()`, and `release()`. The adapter combines lease/run/caller/timeout cancellation and uses that owner-aware getter without bypassing other guards. The handle is released only after the HTTP/body work actually settles, including after timeout/abort; returning a timeout to the graph does not release a still-running transport. Driver metadata alone does not provide this exclusion.

The graph invokes its optional hook only after a model-explicit `observeEditorWindow` invocation has completed, before conversion into visual evidence. It supplies a clone of that result. A validated advisory is included in the observation ToolMessage consumed by the existing LLM. A validated reobserve choice deterministically withholds that observation image from further target selection and adds guidance requesting a separate explicit observation. A sufficient choice retains the normal image path; it does not establish visual correctness, task success or authority. Uncertain/invalid results retain the original image and existing LLM path. No branch executes input or automatically observes. Main configuration/credential wiring still depends on the separately owned backend contract; an unconfigured hook leaves behavior unchanged.

## Validation and limits

The adapter checks session/run/window/frame/layout/content identity, captured timestamp and age (<5 seconds), held count zero, cleanup complete, and active run before key access/network and after awaits. It snapshots trusted candidates and instructions, rejects duplicate/unknown/missing IDs, checks resolved model and response shape, verifies each probability lies in `[0,1]`, the distribution sums to approximately one, and the selected candidate has maximal probability. Low selected probability, stale evidence, disabled config, missing key, lease refusal, timeout, cancellation, schema failure, HTTP failure, or an opaque exception returns `null` and preserves the existing LLM path.

At most three requests are attempted per session/run, then the existing LLM path is retained. One request is attempted per explicit frame identity. There are no retries or redirects. Input PNG text is limited to 2,000,000 characters and streamed response bytes to 32,768. Replay bookkeeping is capped at 1,000 frame identities per hook lifetime, after which it falls back rather than evicting protection. The fixed official endpoint prevents configurable endpoint or redirect credential leakage. Errors and keys are never returned, logged, or placed in annotations.

The 0.95 threshold is a conservative, configurable fallback policy, **not measured correctness or calibrated application accuracy**. TypeSafe's [confidence explanation](https://docs.typesafe.ai/confidence.md) distinguishes confidence as a distribution statistic from the probability assigned to an option. The adapter thresholds selected probability; no threshold has been calibrated on OpenScene tasks. Mock tests verify protocol/branch behavior only. No paid/live call, real account validation, model download, or empirical judgment-quality evaluation has been performed.

Desktop window observation is platform-bound. Mobile cannot use this desktop window driver; it must retain its existing model path and must not simulate observation or expose desktop credentials. No shared editing rule or mobile model is changed by this main-only adapter.

## Verification evidence

Mock registered-tool JSON-string integration exercises default off, sufficient, reobserve, uncertainty, thrown-hook and absent-hook branches, including image preservation/withholding. Native Node fetch tests use only a loopback HTTP server with fake keys and the actual CuaDriver lease: streamed-body input exclusion, Stop cancellation, and noncooperative transport retaining Stop until settlement. These are protocol/lifetime checks, not an authenticated TypeSafe test or an Electron GUI test.
Loading
Loading