Skip to content

Integrate live Mac dashboard, exact usage and shared Swift account backend - #1354

Open
kydo-researcher wants to merge 3 commits into
Layr-Labs:codex/desktop-appfrom
kydo-researcher:codex/desktop-live-data-and-shared-cli
Open

kydo-researcher wants to merge 3 commits into
Layr-Labs:codex/desktop-appfrom
kydo-researcher:codex/desktop-live-data-and-shared-cli

Conversation

@kydo-researcher

@kydo-researcher kydo-researcher commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

This PR targets codex/desktop-app (PR #1318) and brings the locally tested dashboard, usage accounting, cooling fixes, and API simplification into that branch.

The Electron app keeps the same Swift darkbloom CLI/backend. Swift owns local observations, coordinator access, account credentials, caching and native operations; Electron renders those observations through the existing fixed IPC bridge.

What changes for users

Home and live Mac activity

  • Replace “Tokens shared this session” with “Tokens processed this session”, formatted as an exact integer, and position settled session dollars below and to the right.
  • Show input and output counts, with cached input and reasoning as included subsets. Missing subset counters remain unavailable rather than being invented or counted twice.
  • Remove Home explainers and the Workspace/Home breadcrumb; hide TPS, In progress and Waiting when the backend cannot provide them while retaining genuine reported zeroes.
  • Reorganize the chip card into a larger diagram and a structured hardware/memory sidebar. Keep GPU/CPU utilization prominent, group GPU power/clock, and list all loaded models in a vertical color key.
  • Remove memory-traffic, Neural Engine, media/display and I/O blocks from both diagram styles. Cross-hatch other-app/macOS memory and give loaded models distinct colors. Footprint estimates stay marked as estimates.
  • Drive production activity only from this Mac’s observations. CPU uses measured per-core activity; GPU uses measured whole-GPU utilization uniformly because macOS does not expose individual GPU-core activity here. Stale measurements turn lights off. Synthetic request phases, traffic and sweeps are removed from the live path.

Usage accounting, earnings, models and Mac Stats

  • Record terminal inference metadata in an owner-only local usage journal without blocking completion on journal I/O. Export optional input/cache/output/reasoning counters in local daemon state; no coordinator WebSocket wire shape changes.
  • Calculate processed tokens as input + output exactly once. On older providers, backfill verified settled history, matching this Mac by observed identity/key and the current provider session, and deduplicate persisted records by settlement ID.
  • Preserve confirmed totals across desktop restarts and the coordinator-URL cache-key normalization. Pending/unsettled requests remain visible as pending; unavailable usage is not fabricated.
  • Populate account totals, charts and model rankings from shared earnings data. Rank models by settled account earnings over the 30-day view and display actual loaded/running/idle slots independently from saved serving selections.
  • Give Home seven calendar-day chart positions. Legacy last-1,000-record responses retain partial-history labels and unavailable days; the existing account-earnings endpoint’s window option supplies complete seven-/30-day aggregates.
  • Populate this Mac’s Stats with verified input/output/processed counts, settled earnings, model activity and request metadata. Use settlement/completion time for activity buckets; omit unsupported timing/speed columns. Current local request history is available without dashboard login, and money joins only matching job IDs/completion timestamps.

Cooling and compatibility

  • Resolve and verify the existing signed Darkbloom runtime/helper for privileged cooling operations instead of attempting to provision through an unsigned review binary.
  • Retry the specific transient fan-ownership/SMC firmware rejection up to three times. Preserve the firmware cause after a permanent failure; report cancellation only for the actual macOS cancellation code.
  • Reflect the supported manual fan policy/range. Gate unsupported Autopilot/waitlist actions by native capabilities and start serving through supported controls.
  • Avoid running a second automatic updater while the provider is active.

Shared backend and API changes

Concern Implementation
Renderer refresh useBackend, pageResources, useInsights and useRequestHistory use native state revisions and fetch only resources needed by visible pages; remove independent polling timers.
Action completion Subscribe before submitting an operation, consume terminal state events, and use a bounded wake-up fallback only when the stream goes silent.
Coordinator reads DesktopResources, DesktopAccountCloud and DesktopResourceCache compose existing /v1/me/providers, /v1/me/summary, /v1/provider/account-earnings, public network/catalog and latest-release responses.
Cache/security Coalesce in-flight reads, scope private cache keys to coordinator and credential, back off failed requests, discard stale responses after account/config changes, and clear private observations on auth rejection.
Releases Share latest-release/notes reads across release and history projections rather than probing a separate desktop-release route.
Account login Reuse device-code login with purpose desktop_account, explicit browser consent, opaque read-only account credentials and 30-day expiry. Swift stores credentials owner-only, separately from provider credentials.
CLI parity Add darkbloom desktop login / logout using the same account session store and flow as Electron.
Read-only scope Dashboard credentials are accepted only by the three account reads above and session revocation. Provider registration, inference, billing mutations and legacy privileged desktop reads reject them.
Sign-out Clear native account credentials/caches and attempt bounded server revocation without unlinking or stopping the provider. Once dashboard sign-in/out has occurred, do not silently fall back to another provider account.
Grant exchange ConsumeDeviceCode atomically consumes an approved, unexpired account grant once in both MemoryStore and PostgresStore. Concurrent losers revoke their newly created token.

Routes and persistence: add DELETE /v1/device/token; extend the existing device-code endpoints with purpose-bound consent/exchange; add window=7d|30d to the existing account-earnings read. Reuse the existing hashed provider-token and device-code tables with distinct scope prefixes; no database schema migration. Keep legacy desktop routes for compatibility, while this app stops probing them.

Before

flowchart TB
  subgraph UI["Electron UI"]
    H["Home / Models / Stats"] --> R["useBackend + page timers"]
    H --> V["Output-oriented totals and sparse stats"]
    H --> S["Chip mixes samples and simulated activity"]
  end
  subgraph Native["Swift desktop backend"]
    R --> D["DesktopResources: independent reads"]
    D --> C["Desktop account / insights / release endpoints"]
    C --> F["404 or unavailable account views"]
    A["Cooling action"] --> U["Review runtime helper provisioning"]
    U --> E["Authorization or ownership failure"]
  end
  classDef ui fill:#dbeafe,stroke:#2563eb,color:#172554
  classDef native fill:#dcfce7,stroke:#16a34a,color:#14532d
  classDef issue fill:#fee2e2,stroke:#dc2626,color:#7f1d1d
  class H,R,V,S ui
  class D,C,A,U native
  class F,E issue
Loading

After

flowchart TB
  subgraph UI["Electron UI"]
    H["Home / Models / Stats"] --> R["useBackend + pageResources: visible reads"]
    R --> I["Fixed IPC bridge"]
    O["Exact observed totals, earnings, loaded models"]
  end
  subgraph Native["Same Swift darkbloom CLI"]
    I --> B["DesktopBackend + streamed state revisions"]
    B --> C["DesktopResourceCache: scoped + coalesced"]
    B --> J["ProviderUsageHistory + DesktopUsageHistory"]
    C --> P["Existing account / public / latest-release reads"]
    J --> T["Local usage or verified settled history"]
    P --> O
    T --> O
    L["DesktopAccountActions / desktop login"] --> D["DeviceAuth + purpose-bound browser consent"]
    D --> K["Separate read-only session; expiry / revocation"]
    K --> C
    A["DesktopCoolingAuthorization"] --> F["DesktopFanRuntime: verified signed CLI"]
    F --> W["Bounded firmware retry; real success or cause"]
  end
  classDef ui fill:#dbeafe,stroke:#2563eb,color:#172554
  classDef native fill:#dcfce7,stroke:#16a34a,color:#14532d
  classDef external fill:#fef3c7,stroke:#d97706,color:#78350f
  classDef outcome fill:#ede9fe,stroke:#7c3aed,color:#4c1d95
  class H,R,I ui
  class B,C,J,L,D,K,A,F native
  class P,T external
  class O,W outcome
Loading

Blue: Electron; green: shared native backend; amber: observed data; purple: user-visible outcomes; red: prior failure paths. See also the interactive docs/assets/desktop-api-architecture.html diagram.

Validation

Completed on the local review build:

  • make coordinator-test: complete coordinator suite, including 1,794 API tests; coordinator build passed.

  • Focused desktop-account API tests with the Go race detector: purpose-bound consent, concurrent one-shot exchange, owner/read scope, expiry/revocation and >1,000-record window aggregation.

  • make desktop-test: 391 tests across 59 files; desktop lint and production build passed.

  • Swift desktop/auth/counter/history/cooling regressions: 57 tests across 14 suites; native CLI compiled successfully.

  • make desktop-api-test: real isolated HTTP fixture checks auth/isolation, shared release reads, exact counters, stale credentials, account sign-out without provider unlinking, cancellation, idempotency, settings and executable replacement.

  • Console tests: 812 tests across 104 files; console build passed; lint had zero errors and 99 existing warnings.

  • make docs-impact-check BASE=origin/codex/desktop-app and make docs-check: passed with full Git history; patch whitespace passed.

  • Rebuilt and ad hoc signed the local macOS app, verified its deep/strict signature, reopened it and inspected live Home/Stats and native resource responses. Confirmed the signed serving provider and its session start were preserved, including persisted confirmed token/earnings totals.

  • go test -race ./store -run TestConsumeDeviceCode -v: memory-store contract passed (16 concurrent consumers, approved/pending/consumed/expired/missing grants). The equivalent PostgreSQL contract is included for CI; local execution skipped because no throwaway DATABASE_URL is configured.

  • Full make provider-test did not pass in this environment: the XCTest phase reported 56 assertions/errors in MiMo tests requiring unconfigured prompt/payload fixtures; the general Swift Testing phase ran 3,781 tests in 506 suites and reported three fixture-unwrapping issues in MiMo scanner/startup tests. Required inputs include MIMO_PROMPT_ARTIFACT_DIRECTORY, MIMO_PROMPT_REFERENCE_VECTORS and MIMO_V26_SERIAL_LOAD_FIXTURES, which CI provisions before its provider suite. The focused desktop tests above passed; this PR does not claim a complete local provider-suite pass.

  • The published commit is GitHub-verified and both Mermaid diagrams were checked in the GitHub-rendered PR page.

Hosted checks: GitHub Actions are waiting for maintainer approval of this fork contribution. Vercel previews are blocked on team authorization. These are external approval gates; no deployment approval was granted by this PR.

Rollout and practical limits

  • Dashboard account sign-in and complete window aggregates require deploying the coordinator and console changes. Production has not been deployed. Existing linked-provider reads continue to work with older servers until explicit dashboard sign-in/out.
  • Older signed providers can backfill settled input/output usage but cannot recover absent cached/reasoning breakdowns or unsettled input counters. A signed provider release is needed to activate the new local usage journal for network serving.
  • GPU measurements are whole-device, and model footprints/other-app memory remain estimates where the platform cannot attribute them exactly.
  • Legacy account history is bounded to the latest 1,000 records and is marked partial. Release-history projection contains the available latest release, not an invented full release archive.
  • Cooling recovery was regression-tested with injected failures; permanent firmware rejection remains an actionable failure. No real fan-policy mutation was forced during verification.
  • No app binaries, credentials, model weights, local build artifacts or runtime configuration are committed. No release, provider replacement, provider restart, deployment or merge was performed.

…t backend

Simplify Home and live chip activity, preserve exact session usage, rank models by earnings, improve Mac Stats and cooling recovery, and reuse existing coordinator APIs through scoped native caches and read-only dashboard sessions. Include native, UI, API and store regression tests and canonical documentation.
@vercel

vercel Bot commented Oct 5, 2026

Copy link
Copy Markdown

@kydo-researcher is attempting to deploy a commit to the EigenLabs Team on Vercel.

A member of the Team first needs to authorize it.

…count-polish

Make desktop Models Autopilot-first; polish sign-in, cooling and notifications
This was referenced Oct 13, 2026
This was referenced Oct 14, 2026
@jonathan308

Copy link
Copy Markdown
Collaborator

Superseded by #1518, which brings the complete desktop app (this PR's changes plus the merged audit fixes on codex/desktop-mac-preview-20261012) onto current master as one conflict-free PR. Leaving this open for the owner to close.

This branch has not been deployed

No deployments
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.

2 participants