Skip to content

Commit f527df9

Browse files
feat(remote): add a host-allocated macos-app lease backend (#3236)
* feat(remote): add a host-allocated macos-app lease backend A macos-app lease confines a proxy client to one macOS app, named by bundle id and optionally pinned to a pid. Only the host allocates it, over the loopback /admin/leases route with the daemon token. Request admission refuses other apps, non-app surfaces, full-screen capture and commands outside an allow list, and requires the native app backend. A session under the lease holds its app rather than the host Mac. A daemon policy leases.require refuses requests that name no lease, and /health advertises leaseBackends. Refs #3229. * fix(remote): refuse device selectors and require platform macos under a macos-app lease * fix(daemon): confine lease-exempt commands under a macos-app lease Commands declare appLease: 'allowed' in the command registry, which replaces the local macos-app allow list. Lease admission now checks it before the leaseAdmissionExempt early return whenever the daemon policy requires a lease or the request or its session names a macos-app lease, so doctor, session_list, devices and the other exempt commands are refused there; only lease_heartbeat and lease_release pass. leases.require accepts only macos-app. * fix(daemon): require the leased app session under a macos-app lease A request under a macos-app lease that named no existing session resolved the host Mac from its flags and ran with no app bundle id, so a sessionless snapshot or screenshot was not confined to the leased app. Every request but open, the batch envelope, lease_heartbeat and lease_release must now run in an existing session of the leased app, and is otherwise refused with MACOS_APP_LEASE_DENIED and rule session. Batch steps re-enter request admission with the daemon policy, so a step that runs before open is refused the same way. * refactor(daemon): share the host admin JSON body reader and sender * refactor(daemon): take the macos-app claim exemption from the device claim rule deviceClaimRuleForOwner now also reads the admitted lease and returns none for a macos-app lease, so session open no longer keys its claim carve-out on the lease backend. The open conflict helper moves above the doc block that belongs to findNewSessionDeviceConflict. * refactor(remote): share the remote temp artifact path shape with the macos-app lease * refactor: derive the lease backend enums from LEASE_BACKENDS * fix(daemon): cap tenant heartbeats of a host-allocated lease at the host window * fix(daemon): advertise the macos-app lease backend only on a macOS host * fix(macos-helper): act only inside the session app's windows on the native backend The native backend's hit test runs on the app's accessibility tree, which also holds the app's menu bar, and the menu bar's Apple menu acts for the whole Mac (Sleep, Lock Screen, Recent Items). press, focus and fill now refuse a point outside every window the app owns, and a resolved target inside its menu bar, with no-accessible-target. * refactor(remote): keep the remote temp artifact path shape inside daemon-artifacts * fix(daemon): omit host paths and the host device from macos-app lease responses Under a macos-app lease, open no longer returns the session state and log paths or the device, and redacts its warnings and initial snapshot failure. A failure no longer returns logPath or diagnosticsRecord and has host paths and the host name replaced in its text. A snapshot's fallback screenshot path stays on the host. The request diagnostics route is not served to a tenant that held the lease, nor by a daemon that requires one. * fix(remote): bind the host-allocated macos-app lease on connect * fix(remote): never release a host-allocated macos-app lease from a tenant A macos-app lease is allocated and ended only by the host administrator. Disconnect and a forced reconnect now skip lease_release for it, the daemon refuses a tenant lease_release with MACOS_APP_LEASE_HOST_OWNED, and a same-session connect that names a different macos-app lease id needs --force. * docs(remote): say a tenant cannot release a host-allocated macos-app lease
1 parent f5b48d8 commit f527df9

48 files changed

Lines changed: 2899 additions & 110 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎apple/macos-helper/Sources/AgentDeviceMacOSHelper/BackgroundInteraction.swift‎

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,13 @@ func pressInBackground(
9595
)
9696
}
9797
let point = CGPoint(x: request.x, y: request.y)
98+
try requireAppWindowPoint(point, app: app)
9899
cursor?.move(to: point)
99-
guard let target = resolvePressTarget(app: app, point: point),
100-
let mechanism = perform(target)
101-
else {
100+
let target = resolvePressTarget(app: app, point: point)
101+
if let target, isInMenuBar(target.element) {
102+
throw refusal(.noAccessibleTarget, "the point is on the app's menu bar", app: app)
103+
}
104+
guard let target, let mechanism = perform(target) else {
102105
throw refusal(.noAccessibleTarget, "no pressable accessibility element at the point", app: app)
103106
}
104107
var clicks = 1
@@ -165,12 +168,16 @@ func fillInBackground(
165168
app: NSRunningApplication,
166169
cursor: GhostCursor?
167170
) throws -> BackgroundTextResponse {
171+
try requireAppWindowPoint(point, app: app)
168172
cursor?.move(to: point)
169173
let hit = elementAtPoint(in: app, point: point)
170174
let chain = hit.map(pressSearchChain) ?? []
171175
let fallback = actionWindow(app: app, hit: hit).flatMap { window in
172176
smallestElement(in: window, containing: point, where: isTextInput)
173177
}
178+
if let input = chain.first(where: isTextInput) ?? fallback, isInMenuBar(input) {
179+
throw refusal(.noAccessibleTarget, "the point is on the app's menu bar", app: app)
180+
}
174181
guard let input = chain.first(where: isTextInput) ?? fallback,
175182
isAttributeSettable(input, attribute: kAXValueAttribute as String)
176183
else {
@@ -294,6 +301,44 @@ private func perform(_ target: PressTarget) -> BackgroundDeliveryMechanism? {
294301
}
295302
}
296303

304+
/// The app's accessibility tree also holds its menu bar, whose Apple menu acts for the whole Mac
305+
/// (Sleep, Lock Screen, Recent Items). A point action therefore lands only inside one of the app's
306+
/// own on-screen windows, its menus and sheets included, and never on a menu bar element: the app
307+
/// owns its menu bar's window too, so the window check alone does not exclude it.
308+
private func requireAppWindowPoint(_ point: CGPoint, app: NSRunningApplication) throws {
309+
guard
310+
let info = CGWindowListCopyWindowInfo([.optionOnScreenOnly, .excludeDesktopElements], kCGNullWindowID)
311+
as? [[String: Any]]
312+
else {
313+
throw refusal(.noAccessibleTarget, "the app's on-screen windows could not be read", app: app)
314+
}
315+
let inAppWindow = info.contains { entry in
316+
guard (entry[kCGWindowOwnerPID as String] as? Int32) == app.processIdentifier,
317+
let boundsDict = entry[kCGWindowBounds as String] as? NSDictionary,
318+
let bounds = CGRect(dictionaryRepresentation: boundsDict as CFDictionary)
319+
else {
320+
return false
321+
}
322+
return bounds.contains(point)
323+
}
324+
guard inAppWindow else {
325+
throw refusal(.noAccessibleTarget, "the point is outside the app's on-screen windows", app: app)
326+
}
327+
}
328+
329+
private func isInMenuBar(_ element: AXUIElement) -> Bool {
330+
var current: AXUIElement? = element
331+
var depth = 0
332+
while let node = current, depth < 32 {
333+
let nodeRole = role(of: node)
334+
if nodeRole == "AXMenuBar" || nodeRole == "AXMenuBarItem" { return true }
335+
if nodeRole == "AXApplication" { return false }
336+
current = elementAttribute(node, attribute: kAXParentAttribute as String)
337+
depth += 1
338+
}
339+
return false
340+
}
341+
297342
/// The app's own hit test, scoped to the app so windows of other apps above it do not answer.
298343
private func elementAtPoint(in app: NSRunningApplication, point: CGPoint) -> AXUIElement? {
299344
let appElement = AXUIElementCreateApplication(app.processIdentifier)

‎docs/adr/0007-remote-device-leases.md‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,35 @@ reconnect and re-establish them; no persisted hold store is used. Local takeover
165165
future host-global human-control fence must coexist with the local session's device claim, not
166166
acquire it exclusively.
167167

168+
## macOS app leases
169+
170+
A lease on the macOS host would rent the whole desktop, so the macOS platform rents one app instead.
171+
A `macos-app` lease's device key is a bundle id, optionally pinned to one process
172+
(`<bundleId>` or `<bundleId>@<pid>`). The scope would be self-chosen if a tenant could name it, so
173+
only a host administrator allocates one, over the loopback `/admin/leases` route that uses the daemon
174+
token like host holds; tenant `lease_allocate` refuses the backend. The host picks the lease id, a
175+
repeated PUT renews it, and a PUT naming another scope for an existing id is refused rather than
176+
rewritten. Heartbeat, expiry, release, and the loss on daemon restart are those of any lease, except
177+
that a tenant heartbeat or request cannot renew it for longer than the window of the host's last PUT.
178+
179+
Request admission confines every request admitted under the lease, so `batch` steps and `replay`
180+
actions are confined when they re-enter it: an allow list of commands, the ones whose command
181+
registry descriptor declares `appLease: 'allowed'` (later commands are refused, and of the commands
182+
lease admission otherwise exempts only `lease_heartbeat` and `lease_release` declare it),
183+
`open` and `close` of the leased bundle only, the `app` surface only, window-only screenshots, no
184+
input that names a host path or launches beside the app, and an existing session that is the leased
185+
app for every request but `open`, the `batch` envelope, and the lease's heartbeat and release, so a
186+
request naming no session cannot fall back to the host Mac. `open` requires the native app backend (ADR 0031), because XCTest
187+
posts screen events that can land outside the app's window. A pid-pinned lease is checked against the
188+
running process before each admitted request. A session opened under the lease holds its app, not
189+
the Mac: it takes no host device claim, and other app-leased sessions on the same Mac do not conflict
190+
with it, so one daemon serves several leased apps beside the host's own sessions.
191+
192+
These rules bind a request that names the lease or runs in its session. A daemon policy
193+
`leases.require` (ADR 0029) refuses requests that name no lease. The proxy token is one credential
194+
for every client, so a host serving several clients through one proxy authenticates each client and
195+
sets its tenant, session isolation, and lease on every request it forwards.
196+
168197
## Host managed-device durability amendment
169198

170199
ADR 0021 adds a narrow durability exception for Host leases backed by a managed-device allocator.

‎docs/adr/0029-daemon-policy.md‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Accepted (2026-09-29).
2323
command asks for it. The one exception is Apple readiness rolling back a Simulator boot that
2424
the same request started and then canceled: the Simulator was not running before.
2525
4. A denial is `UNAUTHORIZED` with `details.reason: 'DAEMON_POLICY_DENIED'`, the `rule`
26-
(`command`, `device`, or `capability`), the policy digest, `retriable: false`, and a hint. It
26+
(`command`, `device`, `capability`, or `lease`), the policy digest, `retriable: false`, and a hint. It
2727
never names the policy's host path.
2828
5. The daemon publishes the policy digest in `daemon.json`. A client that names a policy refuses to
2929
reuse a daemon that enforces a different one, or none. A client that names no policy reuses
@@ -36,7 +36,8 @@ Accepted (2026-09-29).
3636
"version": 1,
3737
"devices": { "allow": [{ "udid": "8F1C…" }, { "serial": "emulator-5554" }] },
3838
"commands": { "deny": ["boot", "shutdown"] },
39-
"capabilities": { "deny": ["device-shutdown"] }
39+
"capabilities": { "deny": ["device-shutdown"] },
40+
"leases": { "require": "macos-app" }
4041
}
4142
```
4243

@@ -56,6 +57,11 @@ Accepted (2026-09-29).
5657
upgrade are denied by default.
5758
- `capabilities.deny` — operations denied whichever command reaches them. `device-shutdown` is the
5859
only capability today.
60+
- `leases.require` — `macos-app`, the only accepted value. Every request must be admitted under a
61+
`macos-app` lease and pass its command allow list (ADR 0007), including commands lease admission
62+
otherwise exempts; of those, only `lease_heartbeat` and `lease_release` pass. A request naming no
63+
lease is refused instead of being admitted unleased, with `rule: 'lease'`. A host that confines
64+
clients to `macos-app` leases sets it so a client cannot drop its lease to reach the desktop.
5965

6066
Unknown keys are errors, so a misspelled rule cannot silently become no rule.
6167

‎docs/adr/0031-macos-native-app-backend.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,10 @@ the background. A dropped post still reports success, and a fallback that cannot
6161
work would turn "nothing happened" into success, so pointer actions have no event fallback until
6262
an event path verifies its outcome.
6363

64-
**Target resolution.** The helper hit-tests inside the session app (other apps' windows above it do
65-
not answer) and walks at most four ancestors for a text input or a pressable control role.
64+
**Target resolution.** The helper acts only on a point inside one of the session app's own on-screen
65+
windows (its menus and sheets included) and never on its menu bar, whose Apple menu acts for the whole Mac
66+
(Sleep, Lock Screen, Recent Items); other points are refused with `no-accessible-target`. It
67+
hit-tests inside the session app (other apps' windows above it do not answer) and walks at most four ancestors for a text input or a pressable control role.
6668
Chromium answers a hit test with wrapper groups that all claim `AXPress`, so when the chain names
6769
no control the helper picks the smallest such element whose frame contains the point, searching
6870
only the window the hit landed in (the app's front on-screen window when the hit names none). A

‎packages/command-registry/src/daemon-command-descriptor.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ export type DaemonCommandDescriptor<TRequest = DispatchedCommand> = {
3737
sessionKind?: SessionCommandKind;
3838
refFrameEffect?: DaemonRefFrameEffect<TRequest>;
3939
leaseAdmissionExempt?: boolean;
40+
/**
41+
* ADR 0007: this command may run under a `macos-app` lease, or on a daemon whose policy requires
42+
* one. A command without it is refused there, `leaseAdmissionExempt` or not, so a command
43+
* added later stays out until it opts in.
44+
*/
45+
appLease?: 'allowed';
4046
sessionExecutionLockExempt?: boolean;
4147
selectorValidationExempt?: boolean;
4248
replayScopedAction?: boolean;

‎packages/command-registry/src/flag-definitions-connection.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { LEASE_BACKENDS } from '@agent-device/kernel/contracts';
12
import { PROVIDER_DEVICE_ORIENTATIONS } from '@agent-device/contracts/remote';
23
import type { FlagDefinition } from './flag-types.ts';
34

@@ -131,8 +132,8 @@ export const CONNECTION_FLAG_DEFINITIONS: readonly FlagDefinition[] = [
131132
key: 'leaseBackend',
132133
names: ['--lease-backend'],
133134
type: 'enum',
134-
enumValues: ['ios-simulator', 'ios-instance', 'android-instance', 'harmonyos-instance'],
135-
usageLabel: '--lease-backend ios-simulator|ios-instance|android-instance|harmonyos-instance',
135+
enumValues: LEASE_BACKENDS,
136+
usageLabel: `--lease-backend ${LEASE_BACKENDS.join('|')}`,
136137
usageDescription: 'Lease backend for remote tenant connection admission',
137138
projectConfig: false,
138139
recorded: false,

‎packages/command-registry/src/registry.ts‎

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,7 @@ export const RAW_COMMAND_DESCRIPTORS = [
548548
route: 'lease',
549549
refFrameEffect: 'preserve',
550550
...ADMISSION_AND_LOCK_EXEMPT,
551+
appLease: 'allowed',
551552
},
552553
timeoutPolicy: LEASE_TIMEOUT_POLICY,
553554
batchable: false,
@@ -563,6 +564,7 @@ export const RAW_COMMAND_DESCRIPTORS = [
563564
route: 'lease',
564565
refFrameEffect: 'preserve',
565566
...ADMISSION_AND_LOCK_EXEMPT,
567+
appLease: 'allowed',
566568
},
567569
timeoutPolicy: LEASE_TIMEOUT_POLICY,
568570
batchable: false,
@@ -1025,6 +1027,7 @@ export const RAW_COMMAND_DESCRIPTORS = [
10251027
refFrameEffect: 'may-invalidate',
10261028
allowSessionlessDefaultDevice: allowAnyDeviceSessionless,
10271029
saveScriptFlagOwner: true,
1030+
appLease: 'allowed',
10281031
},
10291032
// --timeout is a startup budget: it reaches the Simulator boot wait (#2324).
10301033
timeoutPolicy: { ...DEFAULT_TIMEOUT_POLICY, budget: { source: 'flag', envelope: 'margin' } },
@@ -1057,7 +1060,7 @@ export const RAW_COMMAND_DESCRIPTORS = [
10571060
catalog: { group: 'public' },
10581061
frameworkTier: 'extended',
10591062
recordsSessionAction: false,
1060-
daemon: { route: 'session', refFrameEffect: 'delegated' },
1063+
daemon: { route: 'session', refFrameEffect: 'delegated', appLease: 'allowed' },
10611064
timeoutPolicy: DEFAULT_TIMEOUT_POLICY,
10621065
batchable: false,
10631066
// Wave 6 residue: every step runs as its own daemon request under its own descriptor, which
@@ -1078,6 +1081,7 @@ export const RAW_COMMAND_DESCRIPTORS = [
10781081
allowInvalidRecording: true,
10791082
saveScriptFlagOwner: true,
10801083
sessionlessLeaseAdmissionExemption: resolvePlainCloseLeaseAdmissionExemption,
1084+
appLease: 'allowed',
10811085
},
10821086
timeoutPolicy: DEFAULT_TIMEOUT_POLICY,
10831087
batchable: true,
@@ -1093,7 +1097,7 @@ export const RAW_COMMAND_DESCRIPTORS = [
10931097
frameworkTier: 'core',
10941098
recordsSessionAction: true,
10951099
recordingEffect: 'observes-app',
1096-
daemon: { route: 'snapshot', refFrameEffect: 'preserve' },
1100+
daemon: { route: 'snapshot', refFrameEffect: 'preserve', appLease: 'allowed' },
10971101
// First Apple snapshot on a device can sit behind runner startup; --timeout
10981102
// widens the envelope, and a timeout must not tear down the daemon.
10991103
timeoutPolicy: { ...PRESERVE_DAEMON_TIMEOUT_POLICY, budget: { source: 'flag' } },
@@ -1132,7 +1136,7 @@ export const RAW_COMMAND_DESCRIPTORS = [
11321136
// #1349: a wait's landmark may legitimately be absent when the step
11331137
// starts, so identity verification runs inside its polling resolution.
11341138
targetIdentityVerification: 'post-resolution',
1135-
daemon: { route: 'snapshot', refFrameEffect: 'preserve' },
1139+
daemon: { route: 'snapshot', refFrameEffect: 'preserve', appLease: 'allowed' },
11361140
// The wait budget travels as a positional, not a flag; parse it the same
11371141
// way the daemon will so the request envelope extends past it (#1075).
11381142
timeoutPolicy: {
@@ -1271,6 +1275,7 @@ export const RAW_COMMAND_DESCRIPTORS = [
12711275
daemon: {
12721276
route: 'find',
12731277
refFrameEffect: 'may-invalidate',
1278+
appLease: 'allowed',
12741279
},
12751280
timeoutPolicy: PRESERVE_DAEMON_TIMEOUT_POLICY,
12761281
batchable: true,
@@ -1301,6 +1306,7 @@ export const RAW_COMMAND_DESCRIPTORS = [
13011306
route: 'interaction',
13021307
refFrameEffect: 'may-invalidate',
13031308
androidBlockingDialogGuard: true,
1309+
appLease: 'allowed',
13041310
},
13051311
timeoutPolicy: postActionObservationTimeoutPolicy('click', PRESERVE_DAEMON_TIMEOUT_POLICY),
13061312
postActionObservation: postActionObservation('click'),
@@ -1313,6 +1319,7 @@ export const RAW_COMMAND_DESCRIPTORS = [
13131319
name: 'fill',
13141320
...(ownerFilesEnabled ? { ownerFiles: ['src/commands/interaction/index.ts'] as const } : {}),
13151321
...TARGETED_TOUCH_INTERACTION_TRAITS,
1322+
daemon: { ...TARGETED_TOUCH_INTERACTION_TRAITS.daemon, appLease: 'allowed' },
13161323
frameworkTier: 'core',
13171324
timeoutPolicy: postActionObservationTimeoutPolicy('fill', PRESERVE_DAEMON_TIMEOUT_POLICY),
13181325
postActionObservation: postActionObservation('fill'),
@@ -1360,6 +1367,7 @@ export const RAW_COMMAND_DESCRIPTORS = [
13601367
name: 'press',
13611368
...(ownerFilesEnabled ? { ownerFiles: ['src/commands/interaction/index.ts'] as const } : {}),
13621369
...TARGETED_TOUCH_INTERACTION_TRAITS,
1370+
daemon: { ...TARGETED_TOUCH_INTERACTION_TRAITS.daemon, appLease: 'allowed' },
13631371
frameworkTier: 'core',
13641372
timeoutPolicy: postActionObservationTimeoutPolicy('press', PRESERVE_DAEMON_TIMEOUT_POLICY),
13651373
postActionObservation: postActionObservation('press'),
@@ -1380,6 +1388,7 @@ export const RAW_COMMAND_DESCRIPTORS = [
13801388
route: 'interaction',
13811389
refFrameEffect: 'may-invalidate',
13821390
androidBlockingDialogGuard: true,
1391+
appLease: 'allowed',
13831392
},
13841393
timeoutPolicy: postActionObservationTimeoutPolicy('type', PRESERVE_DAEMON_TIMEOUT_POLICY),
13851394
batchable: true,
@@ -1394,7 +1403,7 @@ export const RAW_COMMAND_DESCRIPTORS = [
13941403
frameworkTier: 'core',
13951404
recordsSessionAction: true,
13961405
recordingEffect: 'observes-app',
1397-
daemon: { route: 'interaction', refFrameEffect: 'preserve' },
1406+
daemon: { route: 'interaction', refFrameEffect: 'preserve', appLease: 'allowed' },
13981407
timeoutPolicy: postActionObservationTimeoutPolicy('get', PRESERVE_DAEMON_TIMEOUT_POLICY),
13991408
batchable: true,
14001409
platformExecution: { kind: 'device-runtime', uses: selectorTextCaptureRuntimePlanUses },
@@ -1408,7 +1417,7 @@ export const RAW_COMMAND_DESCRIPTORS = [
14081417
frameworkTier: 'core',
14091418
recordsSessionAction: true,
14101419
recordingEffect: 'observes-app',
1411-
daemon: { route: 'interaction', refFrameEffect: 'preserve' },
1420+
daemon: { route: 'interaction', refFrameEffect: 'preserve', appLease: 'allowed' },
14121421
timeoutPolicy: postActionObservationTimeoutPolicy('is', PRESERVE_DAEMON_TIMEOUT_POLICY),
14131422
batchable: true,
14141423
platformExecution: { kind: 'device-runtime', uses: selectorCaptureRuntimePlanUses },
@@ -1500,6 +1509,7 @@ export const RAW_COMMAND_DESCRIPTORS = [
15001509
// the owner's `scrollDirection` fact, and the only execution is the bound operation. `scroll`
15011510
// was the last holder of the legacy `dispatch`/`capability` pair, which retires with it.
15021511
...GENERIC_MUTATING_COMMAND_TRAITS,
1512+
daemon: { ...GENERIC_MUTATING_COMMAND_TRAITS.daemon, appLease: 'allowed' },
15031513
timeoutPolicy: postActionObservationTimeoutPolicy('scroll', DEFAULT_TIMEOUT_POLICY),
15041514
postActionObservation: postActionObservation('scroll'),
15051515
platformExecution: { kind: 'device-runtime', uses: scrollRuntimePlanUses },
@@ -1531,6 +1541,7 @@ export const RAW_COMMAND_DESCRIPTORS = [
15311541
// R40 retires this command's capability bucket and its `dispatch` leaf together: admission is
15321542
// the owner's `focusPoint` fact, and the only execution is the bound operation.
15331543
...GENERIC_MUTATING_COMMAND_TRAITS,
1544+
daemon: { ...GENERIC_MUTATING_COMMAND_TRAITS.daemon, appLease: 'allowed' },
15341545
platformExecution: { kind: 'device-runtime', uses: [focusRuntimeUse] },
15351546
},
15361547
{
@@ -1548,7 +1559,7 @@ export const RAW_COMMAND_DESCRIPTORS = [
15481559
frameworkTier: 'core',
15491560
recordsSessionAction: true,
15501561
recordingEffect: 'observes-app',
1551-
daemon: { route: 'generic', refFrameEffect: 'preserve' },
1562+
daemon: { route: 'generic', refFrameEffect: 'preserve', appLease: 'allowed' },
15521563
timeoutPolicy: DEFAULT_TIMEOUT_POLICY,
15531564
batchable: true,
15541565
platformExecution: { kind: 'device-runtime', uses: screenshotRuntimePlanUses },

‎packages/contracts/src/daemon-http.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,20 @@ export type DaemonHealthPayload = {
5757
rpcProtocolVersion: number;
5858
instanceId?: string;
5959
hostArch?: string;
60+
/** The lease backends this daemon admits; a host checks it before relying on one. */
61+
leaseBackends?: readonly string[];
6062
upstream?: unknown;
6163
};
6264

6365
export function buildDaemonHealthPayload(
6466
service: DaemonHealthPayload['service'],
6567
version: string,
66-
options: { upstream?: unknown; instanceId?: string; hostArch?: string } = {},
68+
options: {
69+
upstream?: unknown;
70+
instanceId?: string;
71+
hostArch?: string;
72+
leaseBackends?: readonly string[];
73+
} = {},
6774
): DaemonHealthPayload {
6875
return {
6976
ok: true,
@@ -72,6 +79,7 @@ export function buildDaemonHealthPayload(
7279
rpcProtocolVersion: DAEMON_RPC_PROTOCOL_VERSION,
7380
...(options.instanceId !== undefined ? { instanceId: options.instanceId } : {}),
7481
...(options.hostArch !== undefined ? { hostArch: options.hostArch } : {}),
82+
...(options.leaseBackends !== undefined ? { leaseBackends: options.leaseBackends } : {}),
7583
...(options.upstream !== undefined ? { upstream: options.upstream } : {}),
7684
};
7785
}

0 commit comments

Comments
 (0)