Skip to content

Stream and control hosted macOS apps #2474

Closed

Description

@janicduplessis

Track B of #2403. Contracts: contracts comment, sections 1 and 3.

Problem

People cannot see or control a hosted macOS app on a device-host Mac. Hosted viewing and input are hardcoded to iOS.

Evidence

  • DeviceHost.viewTarget and bindView (packages/server/src/device-host.ts), HostedViews (packages/server/src/hosted-view.ts), and hostedMethod in packages/server/src/server.ts (subscribe passes platform: 'ios'; device-host.input.* covers touch, text, button, rotate and posture only).
  • Local macOS viewing already works through FramePool and stim-frames macos <MacosAppState>. MacosSource.swift re-checks pid, start time, executable and bundle id every second and captures the single main window only. control.ts needs input.scroll and input.key for macOS.

Fix idea / scope

  • Add readHostedMacosApp(home) to core/state: it reads the pseudo workspace record under a worker home without relying on the process's STIM_HOME.
  • viewTarget accepts macOS sessions only while macosAppState(...).state === 'running'. HostedViews builds { platform: 'macos', app }. Its identity check compares launchId, pid and start time. A relaunch closes the view.
  • Add device-host.input.scroll and device-host.input.key to the method lists, types and JSON Schema, routed like the other hosted inputs.
  • TCC: the existing refusal text when Screen Recording or Accessibility is missing on the host. Never scripted.

Acceptance

  • Server tests with a fake capture helper: a running hosted app can be subscribed (the helper gets macos plus the recorded JSON with the hosted bundle id) and controlled, including scroll and key. Viewing is refused before launch and after exit. Another client is refused. Existing iOS hosted tests stay unchanged and green.
  • Real single-Mac check against track A's fixture flow: frames of the hosted fixture window come from the real stim-frames on this Mac (the capture host already has its grants), and a click reaches the fixture.

Out of scope

The client-side relay for Desktop and the phone (#2475).

Depends on #2473 (it can start on the A draft branch).

Activity

  1. janicduplessis commented on Oct 5, 2026

    @janicduplessis
    CollaboratorAuthor

    Claimed: feat/2474-hosted-macos-frames

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions