Skip to content

Add an optional Codex pet state bridge contract - #369

Open
francis3253161180-maker wants to merge 6 commits into
Fei-Away:mainfrom
francis3253161180-maker:agent/pet-state-bridge
Open

Add an optional Codex pet state bridge contract#369
francis3253161180-maker wants to merge 6 commits into
Fei-Away:mainfrom
francis3253161180-maker:agent/pet-state-bridge

Conversation

@francis3253161180-maker

@francis3253161180-maker francis3253161180-maker commented Aug 16, 2026

Copy link
Copy Markdown

Summary

This draft PR adds a small, platform-neutral state bridge for optional Codex desktop-pet integrations. It keeps a DOM-only path available while restoring an optional app-server enhancement path for pets that need structured execution states.

What changed

  • Add codex-state-bridge.mjs for source policy, selected-sidebar-row arbitration, and the visible running-marker gate.
  • Preserve three source modes: dom, app-server, and auto.
  • Map app-server approval, turn, item, delta, completion, failure, and interruption events to reusable pet states.
  • Support detailed states including commandExecution, fileRead, fileChange, mcpToolCall, webSearch, plan, reasoning, completed, failed, and aborted.
  • Add pet-runtime.mjs for normalized, reusable pet state emission.
  • Add pet-state-bridge.mjs with sync() and ingestAppServer() adapters.
  • Add focused tests for DOM-only behavior, app-server state mapping, cross-thread filtering, stale completion suppression, and runtime transitions.
  • Document the adapter boundary and the separation between optional pet transport and the core theme injector.

Design intent

DOM remains authoritative for the selected sidebar conversation and its visible running marker. If the selected row is not running, stale DOM or app-server events cannot revive it; the bridge returns idle.

DOM-only mode is useful when an integration wants zero app-server dependency and only needs visible UI states such as approval or user input. It cannot reliably reproduce every structured execution item, so app-server mode is intentionally preserved for enhanced custom pets. In auto, app-server events refine the currently selected running conversation and DOM remains the fallback.

A visible approval or user-input card takes precedence over a generic reasoning event. Events belonging to another conversation are ignored by the bridge.

The core skin injector does not bundle pet art or start an app-server process. A pet package owns its optional transport/process lifecycle and can fall back to dom when app-server is unavailable.

Validation

  • node --check for the bridge modules
  • node windows/tests/pet-state-bridge.test.mjs
  • node windows/tests/injector-bootstrap.test.mjs
  • node windows/tests/injector-one-shot.test.mjs
  • git diff --check

This remains a draft so maintainers can confirm the DOM/app-server adapter boundary before a concrete pet package is integrated.

@francis3253161180-maker
francis3253161180-maker marked this pull request as ready for review August 17, 2026 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant