feat(codex): native overlay integration, CDP-free (deprecate CDP adapter) - #6
Merged
Merged
Conversation
The overlay no longer lives only inside a bound Claude Desktop session. When no exact session binding exists, the widget can now show a "global" face with machine-wide totals across Claude Code, Codex, and Cline. - overlay-bridge: new global-snapshot command returning identity plus usage-history totals (today, lifetime, streak), memoized for 60s - runtime UI: data-mode=global face — TODAY label, identity header, lifetime/streak from meterStats, idle gauge; settings identity rendering shared between session and global faces - native overlay: menu-bar StatusBarController with show/always-visible toggles persisted to visibility.json, LaunchAgent bootout on quit so KeepAlive stops resurrecting the app, and Codex window following via codexBundleID Tests: 145/145 pass (node --test). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
First slice of the Codex native-overlay migration (option 1). Resolves the active Codex thread without CDP by reading the desktop app-server's own state_5.sqlite (threads.recency_at_ms, filtered to thread_source='user'), then reuses the existing RolloutStore + MetricsEngine for token telemetry. - thread-state.mjs: read-only state DB reader, fails closed to null on a missing file, locked handle, or schema drift so a caller never binds to the wrong thread - snapshot-runtime.mjs: CodexSnapshotRuntime mirroring ClaudeSnapshotRuntime's interface; binding.exact reflects a proven bind, and a selected thread with no telemetry stays unbound rather than adopting another thread's numbers Verified: Token Widget's bundled node (v22.22) reads state_5 via node:sqlite with no flag. Tests 188/188, npm run check clean. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Extend the overlay bridge with a codex-snapshot command so one overlay app and one bridge serve both hosts. The Codex runtime is built lazily, so a Claude-only session never opens the state database or scans ~/.codex. Filter node:sqlite's experimental warning out of the bridge's stderr so it does not repeat into the LaunchAgent log on every start. Tests 189/189, npm run check clean. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A frontmost Codex window now gets a bound face driven by the codex-snapshot bridge command instead of the machine-wide global face. The bridge resolves the active thread from the state database, so the native side supplies no session id and reads no Accessibility tree — it only pins the panel and polls. Adds a third overlay mode alongside the Claude session and global faces, with the mode transitions resetting each other so no stale numbers survive a host switch. swiftc -typecheck clean; JS suite 189/189. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Make the shared overlay host-agnostic so Codex-only machines can install it: - drop the Claude model catalog (app.asar) from the overlay's required-files startup gate; ClaudeContextWindowResolver already degrades to nil when it is absent, and Codex context windows come from the rollout snapshot - install.sh verifies Claude.app only when present (preserving the genuine-app check) and installs Codex-only support when it is absent, instead of exiting Adds a regression test installing the overlay with no Claude.app. Suite 190/190, npm run check clean, swiftc -typecheck clean. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Now that the overlay serves both Claude and Codex, drop "for Claude" from the user-visible name. Sets CFBundleName to "Token Widget" (the display name shown in the Accessibility list and menu bar, previously "Token Widget for Claude"), renames the source-install bundle to "Token Widget.app" to match the DMG, and updates the permission-grant instructions in docs and scripts to suit. Bundle identifier, executable name, and LaunchAgent label are left unchanged so existing installs and the self-update flow keep working. "Token Widget for Claude Code" (the integration name) is preserved. Suite 190/190, check + swiftc clean, plist lints. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The CDP source installer now prints a deprecation notice pointing users at the Token Widget app (silenceable via TOKEN_METER_CODEX_CDP_ACK=1) and still runs. README, the Codex integration README, and CHANGELOG present the native overlay as the recommended way to meter Codex and mark the adapter as legacy. The CDP code is left in place and functional — deprecate first, remove later, once the native path has shipped and proven itself against Codex's state schema. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
@fzn0728 is attempting to deploy a commit to the t54 labs Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two related changes, unified on the native overlay model:
~/.codex/state_5.sqlite,threads.recency_at_msfiltered tothread_source='user') and the existing rollout files — no loopback debugging port, no launch flags, and no quit/relaunch of Codex. This removes the crash-on-restart failure mode and the requirement that Codex be started with CDP.The CDP adapter is deprecated, not deleted — it still works, but prints a notice pointing at the app and is slated for removal once the native path has shipped.
Major changes vs current
main(v0.3.1)CodexSnapshotRuntimeresolves the active thread fromstate_5.sqliteand reusesRolloutStore+MetricsEnginefor tokens. Fails closed — a selected thread with no telemetry stays unbound rather than adopting another thread's numbers.codex-snapshotcommand; the nativeMeterControllergains a bound Codex face (third mode) so a frontmost Codex window gets a real binding instead of the global face.state_5's schema is an internal of Codex Desktop — the reader degrades to unbound if it ever changes.app.asardropped from the startup gate;install.shverifies Claude only when present). Codex-only machines can install it.CFBundleNameand the source-install bundle drop "for Claude". Bundle id, executable name, and LaunchAgent label are unchanged so existing installs and self-update keep working.Why AX wasn't used (Codex differs from Claude)
Claude binds via an
AXURLon its web area. Codex's Accessibility tree exposes no thread identity (bareapp://-/index.html, no per-thread route, no selection state), so the Claude approach doesn't port. The local state DB is the CDP-free equivalent. The officialcodex app-serverRPC also works and cleanly provides account-level totals; it's noted for follow-up but not required here.Tests
npm test— 190/190, including a Codex-only install (no Claude.app), thecodex-snapshotbridge over stdio, and the fail-closed binding cases.npm run checkclean;swiftc -typecheckclean;Info.plistlints.Not covered
Built on top of the always-on-widget work, so this branch includes both.