@@ -11,16 +11,18 @@ import {
1111 type RuntimeOwnerRef ,
1212} from '@agent-device/contracts/platform' ;
1313
14- type UnavailablePlatformRuntimeFacts = Readonly < {
14+ export type UnavailablePlatformRuntimeFacts = Readonly < {
1515 appLog : RuntimeOperationUnavailability ;
1616 network : RuntimeOperationUnavailability ;
1717 screenRecording ?: RuntimeOperationUnavailability ;
18+ readiness ?: RuntimeOperationUnavailability ;
1819} > ;
1920
2021type FrozenUnavailablePlatformRuntimeFacts = Readonly < {
2122 appLog : RuntimeOperationUnavailability ;
2223 network : RuntimeOperationUnavailability ;
2324 screenRecording : RuntimeOperationUnavailability ;
25+ readiness : RuntimeOperationUnavailability ;
2426} > ;
2527
2628/** Builds one honest combined owner for a family with no app-log or network mechanics. */
@@ -33,6 +35,7 @@ export function createUnavailablePlatformRuntimeOwner(
3335 return Object . freeze ( {
3436 owner,
3537 ownsDevice : ( device ) => device . platform === family ,
38+ inspectFacts : async ( device ) => createUnavailablePlatformRuntimeFacts ( device , owner , facts ) ,
3639 bind : async ( request ) => {
3740 if ( request . intent . kind === 'exact-owner' && ! sameRuntimeOwner ( request . intent . owner , owner ) ) {
3841 throw new AppError (
@@ -57,8 +60,23 @@ export function createUnavailablePlatformRuntimeBinding(
5760 owner : RuntimeOwnerRef ,
5861 unavailable : UnavailablePlatformRuntimeFacts ,
5962) : DeviceBinding < PlatformRuntimeOperations > {
60- const { appLog, network, screenRecording } = freezeUnavailableFacts ( unavailable ) ;
61- const facts : RuntimeFacts < PlatformRuntimeOperations > = Object . freeze ( {
63+ const facts = createUnavailablePlatformRuntimeFacts ( device , owner , unavailable ) ;
64+ return Object . freeze ( {
65+ device,
66+ owner,
67+ facts,
68+ operations : Object . freeze ( { } ) ,
69+ [ Symbol . asyncDispose ] : async ( ) => undefined ,
70+ } ) ;
71+ }
72+
73+ export function createUnavailablePlatformRuntimeFacts (
74+ device : DeviceInfo ,
75+ owner : RuntimeOwnerRef ,
76+ unavailable : UnavailablePlatformRuntimeFacts ,
77+ ) : RuntimeFacts < PlatformRuntimeOperations > {
78+ const { appLog, network, screenRecording, readiness } = freezeUnavailableFacts ( unavailable ) ;
79+ return Object . freeze ( {
6280 device : {
6381 ...deviceShape ( device ) ,
6482 providerMode : owner . kind === 'local-family' ? 'local' : 'provider-runtime' ,
@@ -73,15 +91,10 @@ export function createUnavailablePlatformRuntimeBinding(
7391 screenRecordingStart : screenRecording ,
7492 screenRecordingReattach : screenRecording ,
7593 screenRecordingCleanup : screenRecording ,
94+ ensureReady : readiness ,
95+ ensureReadyHeadless : readiness ,
7696 } ,
7797 } ) ;
78- return Object . freeze ( {
79- device,
80- owner,
81- facts,
82- operations : Object . freeze ( { } ) ,
83- [ Symbol . asyncDispose ] : async ( ) => undefined ,
84- } ) ;
8598}
8699
87100function freezeUnavailableFacts (
@@ -93,5 +106,6 @@ function freezeUnavailableFacts(
93106 screenRecording : Object . freeze ( {
94107 ...( unavailable . screenRecording ?? unavailable . network ) ,
95108 } ) ,
109+ readiness : Object . freeze ( { ...( unavailable . readiness ?? unavailable . network ) } ) ,
96110 } ) ;
97111}
0 commit comments