Skip to content

feat(runtime): expose a runtime-native model access lifecycle to hosts #119

Description

@Yevanchen

Context

Mosoo Computer currently implements runtime-native subscription access outside mosoo-agent-driver for Codex, Hermes, and OpenClaw. It works, but every host that wants subscription-backed runtimes would need to recreate the same runtime-specific adapters.

This issue records that implementation as a reference and asks whether the Driver should expose the smallest runtime-neutral lifecycle needed by hosts. It is not a request to move product billing, account storage, or OAuth token custody into the Driver.

Reference implementation

Mosoo Computer currently has one product-facing compatibility map:

Runtime ChatGPT GitHub Copilot xAI
Codex openai
Hermes openai-codex copilot xai-oauth
OpenClaw openai github-copilot xai

The implementation separates these concerns:

  1. Compatibility and native provider names — one runtime/provider map plus binding validation (reference).
  2. Normalized runtime actionsstatus, connect, disconnect, catalog, and select, translated to each runtime native CLI/protocol (contract, runtime adapters).
  3. Cancellable streaming login — device URL/code output is streamed to the host, each attempt has an ID, and host cancellation terminates the native process (client lifecycle, sandbox execution).
  4. Runtime-owned credentials — OAuth/device-login state stays in the runtime native HOME; the host persists/restores that HOME without reading or returning tokens (reference, persistence).
  5. Run-time validation — before dispatch, the host distinguishes disconnected, reconnect-required, entitlement, transient, and invalid-model failures; only a ready binding reaches the turn driver (reference).

Current Driver gap

The Driver already states that hosts own credentials and persistence while it owns provider lifecycle (boundary). ACP initialization also publishes available auth methods and an authenticated/failed event (methods, session result).

However:

  • auth discovery/result is ACP-specific and tied to Driver startup;
  • Codex app-server and runtime-native CLI login are not represented by the common contract;
  • the closed capability set has no model-access lifecycle capability (current capabilities);
  • hosts cannot uniformly query connection state/catalog or start, cancel, reconnect, and disconnect a native account through the Driver.

Proposed minimum contract to explore

Expose a capability-gated runtime-native model access surface, implemented by provider backends where supported:

  • discover supported account/provider IDs and native labels;
  • query normalized connection state: disconnected | connecting | ready | reconnect_required;
  • start/reconnect a login attempt and stream only user-actionable output;
  • cancel an identified in-flight attempt;
  • disconnect the native account;
  • return the authenticated account model catalog;
  • validate or apply the selected provider/model before a run.

The exact shape can reuse Driver commands/events rather than adding a separate local API. Existing ACP auth events are the closest starting point. Unsupported backends should advertise the capability as unsupported instead of emulating it.

Security and ownership invariants

  • The host remains responsible for user/account authorization, durable HOME storage, and access policy.
  • The runtime owns native OAuth/device credentials. The Driver must not return access tokens, refresh tokens, or raw auth files.
  • Login output is bounded and sanitized; secrets and diagnostic stderr are not emitted as ordinary user-visible transcript.
  • Cancellation must stop the native login process and leave a retryable state.
  • A transient catalog/provider failure must not erase a valid sign-in.

Non-goals

  • Billing, credits, entitlements accounting, or pricing.
  • BYOK proxy/grant storage.
  • A generic OAuth framework.
  • Product UI or provider branding policy.
  • Supporting speculative runtimes/providers before a backend can prove the lifecycle.

Suggested first slice

Define the capability and normalized status/event vocabulary, then prove one native backend (Codex + ChatGPT device login) and one ACP backend. Add live coverage for connect/cancel/status/catalog/reconnect without exposing credential material. Hermes/OpenClaw mappings above can remain reference data until their backends are in scope.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions