This implementation is in development. Safari and Codex probes do not establish support in native ACI webviews.
Surface Matrix
Request contract
Extend the existingpane_render.requested request with kind: "browser-image", engine: "chatgpt-aci", and prompt: string (1–16000 characters). Keep existing id, sessionID, toolCall, time, timeoutMs, title, width, height; use format: "html", code: "" only for wire compatibility. These fields are not executable content for browser-image. Unknown kinds must never fall through to native code rendering. Timeout: 10 minutes maximum. Request IDs bind retries to the same job. A browser-image job may only run on a device that is displaying its originating chat, after a person confirms the exact prompt. It never uses a Sessions machine or another device. ACI web sign-in is distinct from ChatGPT OAuth chat authorization.
Execution and return
Use the same-device ACI browser and its private website session. Fixed provider operations only: open ChatGPT; detect sign-in/verification; locate composer; submit exactly once; identify current-turn output; obtain the finished image bytes. Do not inject OAuth tokens or import Safari cookies. Stop on a provider challenge and show Needs you; never bypass it. Keep the browser alive when returning to chat, but do not authorize arbitrary background web.* calls. Sign-out and account switches cancel jobs and tear down retained browser state. Report through the existing pane-render progress route using{lane:"picture",stage,label,preview?,fraction?,bytes?,total_bytes?}. No invented progress. A preview must be a bounded local thumbnail, never a provider-private URL. Opening state is BlockPulse. Real preview replaces it. Saving/downloading uses actual byte counts. tool_progress delivers the same metadata to the approved full/history/peek/running-strip views.
Return the existing pane-render result {ok:true,image:"data:image/png;base64,...",width,height} or {ok:false,error,code?}. Normalize decoded images to PNG on the device. Validate MIME, decoded image and dimensions, with a 20 MiB source limit and an 8 MiB normalized PNG limit (to fit the 16 MiB JSON relay), maximum 4096 pixels per side and 16 million pixels total. Native download must use the browser’s own authenticated context; no screenshot substituted for final bytes. Attach the final image to the original tool turn and Outputs through the existing media_generate result handling. Results must not take their chat IDs from page scripts.
Lifecycle and recovery
A local job owns the browser, not the visible browser view. Explicit Stop cancels. Switching back to chat only hides it. While the OS suspends the phone, report paused/reconnecting rather than promising continued execution. Persist request/conversation identity before submission and never auto-resubmit an ambiguous job after restart. Web/PWA without a same-device capable browser integration returnunsupported; never route to another computer silently. CLI without a local app executor returns an actionable unavailable error.
Claim before execution
After the person confirms, claim the pending browser-image request withPOST /pane-render/:id/claim {executorId} through the authenticated local API. executorId is a client-generated random UUID (16–128 alphanumeric, hyphen or underscore characters), retained with this job. Repeating the same claim is idempotent; another executor receives 409. Include that exact executorId in every progress and reply JSON body for a browser-image job. The runtime refuses unclaimed or mismatched browser-image progress/results. Ordinary native renders retain their existing wire shape. Claim does not authorize sending by itself: local confirmation is still required. Do not generate another executor ID to bypass a conflicting claim.
Local history and files
Explicit image actions save their original user turn, assistant image turn, stable chat identity and bounded PNG on the device. iOS uses account-scoped Application Support files and history. Android uses account-scoped files and an atomic index. Desktop writes an account-scoped PNG and origin manifest before returning success, and the chat store retains local image turns across server transcript reloads. Desktop file reads accept an opaque artifact UUID through trusted IPC; they never accept filesystem paths. Android local-file rendering checks the active account directory. A failed optional server operation cannot be the only copy of the image. These files are local; they are not automatically shared to another device. The explicit Desktop and iOS image paths integrate with their existing local person-plan chat histories. Android’s new local image conversation can create, reopen and export images without a runtime. Its existing text-model transport is unchanged; never send anandroid-local- ID to a computer session endpoint. Local image outputs remain available even when the runtime chat cannot load.
Verification boundary
Source syntax and documentation checks do not establish ChatGPT WebView support. The release train must compile each native target and run the focused contract/ownership/history tests. A real signed-in image run on each supported device must verify prompt confirmation, image mode, current-turn correlation, byte download, original-chat output, Stop, navigation, suspension, account change and replay after interruption. Report unsupported authentication or changed provider markup explicitly. The successful standalone Codex and Safari probes are separate evidence.Image mode engine resolver
Image mode sends no engine name. The runtime picks the engine, and the person’s own send is the confirmation.Metadata contract
A person send in Image or Artifact mode carriesmetadata.turn = "person" and metadata.image_prompt, the raw composer text as a flat string of 1 to 16000 UTF-16 units (a flat string because iOS metadata is a string map). Three allow-lists must pass both keys: turn_image_prompt in cmd/allternit-api/src/v1_routes.rs, cmd/allternit-api/src/agent_session_routes.rs and promptHints in cmd/gizzi-code/src/runtime/server/routes/agent-compat.ts. The runtime advertises the capability image.auto. Clients do not gate on it: an old runtime drops image_prompt, and a client without image_prompt keeps the old ACI path. Only the person’s own turn carries image_prompt.
Engine order
media_generate with kind: "image" and no code calls the resolver in image-engine.ts. The prompt is image_prompt, never the model’s params.prompt. Old lane values (aci, codex, subscription) are treated as auto. Engines run in this order:
codex: the installed Codex CLI on the runtime.chatgpt_browser: the device’s ChatGPT browser (Desktop, iOS, Android), over pane-render.native: when no engine is available the tool tells the model to draw it in code and say so.
Failure classes
A Codex
usageLimitExceeded result with resetsAt sets an in-memory cooldown for that engine; it is skipped until that time. A thrown engine counts as ambiguous. An engine result is accepted only as data:image/png or data:image/gif base64.
Picture delivery
An engine picture (PNG) or GIF is delivered as an assistant file part withmime image/png or image/gif, a data URL in url, a filename, and source.uri set to tool-call:// followed by the call ID. Live, it arrives as an artifact stream frame with sourceUri, url and mimeType; on reload it arrives in metadata.parts as a file part. Clients fold it onto the matching tool call so the picture shows inside that call’s generation card, not as a separate chip or card (web in rust-stream-adapter.ts, iOS in ToolCallRecord.attachedImageURL, Android in ToolCallRecord.attachedImageUrl). The tool result text carries no data URL; the attachment stays on the tool result for the model. Each picture is bounded at 8 MiB. iOS share sends the original bytes, so a GIF stays a GIF.
Once per message and earlier briefs
claimImageJob(userMessageId) allows one engine job per user message. A second call, or an earlier engine part found after that message, returns already_used. The engine prompt is the new brief followed by the person’s earlier image_prompt values from the same chat, labelled as context, within 16000 characters (buildEnginePrompt). The model never writes the engine prompt.
Device host
A browser-image request waits 15 seconds for a device to claim it (claimTimeoutMs); with no host the engine counts as not started. The execution, claim and executor ID rules above stay as written. Instead of a confirm dialog, each device keeps the last Image-mode text it sent for the chat and refuses a runtime browser-image request whose prompt differs. This guard is in memory: after an app restart a runtime request is refused.
GIF
kind: "gif" always renders in code. code is the body of draw(ctx, t, w, h, source), a pure function of t, with a periodic t so the loop closes. source is the optional title of an earlier picture; the fifth argument is then that picture as an image, otherwise it is undefined. Defaults are 480 px, 12 fps and 3 s. Limits are 640 px, 15 fps, 8 s, 120 frames and 8 MiB. gifResult in pane-render/gif-result.ts validates the encoded result against these limits before it is attached. The image/gif type maps to the existing image artifact kind.
Result
Result metadata carriesengine (codex, chatgpt_browser or native) and the legacy lane for old clients. Result codes: person_required, already_used, invalid_request, unsupported, signed_out, sign_in_needed, usage_limit, cancelled, unavailable, invalid_image, ambiguous. The engine is named to the person only in a sign-in action on a failed result.
Codex app-server
The executor iscmd/gizzi-code/src/runtime/tools/builtins/codex-image.ts. It resolves the binary with resolveCliPath, starts codex app-server --listen stdio://, checks account/read for ChatGPT authentication and starts an ephemeral read-only thread. ChatGPT sign-in only: OPENAI_API_KEY, CODEX_API_KEY and OPENAI_BASE_URL are removed from the child environment, so there is no API key path. Shell, unified exec, apps, browser use, computer use and image viewing features are disabled with --disable, and other approval requests are refused.
Only a completed structured imageGeneration item is accepted. Inline bytes, or an artifact path under the job folder or Codex generated-images folder, pass through the bounded PNG validator, and the real decoded size is reported. Stream data is bounded to 24 MiB and PNG bytes to 8 MiB. Agent text and arbitrary paths never establish success. Protocol evidence: Codex 0.171.0 app-server schemas include imageGeneration, savedPath, result and fileId.