Host checked adapter-object controllers through bounded registries (WI-13)

This commit is contained in:
Timothy J. Aveni
2026-09-21 18:00:27 -07:00
parent 1e08ccd937
commit d824634859
14 changed files with 235 additions and 7 deletions
+11
View File
@@ -0,0 +1,11 @@
external atom Display id "device:display";
type Request=record {url:string;text:string;version:int32;};
interface Device id "device" revision "device@1" {
static operation create id "device:create" : string -> atom-ref<Display> {call id "device:create:call" execution transaction targets [browser,server];}
queryable value enabled id "device:enabled" : bool {get id "device:enabled:get" execution snapshot targets [browser,server];set id "device:enabled:set" execution transaction targets [browser,server];}
queryable value requested id "device:requested" : Request {get id "device:requested:get" execution snapshot targets [browser,server];}
queryable value observed id "device:observed" : optional<Request> {get id "device:observed:get" execution snapshot targets [browser,server];}
operation requestText id "device:request" : string -> unit {call id "device:request:call" execution transaction targets [browser,server];}
operation recordObservation id "device:record" : Request -> unit {call id "device:record:call" execution transaction targets [server];}
operation remove id "device:remove" : unit -> unit {call id "device:remove:call" execution transaction targets [server];}
}
+6
View File
@@ -0,0 +1,6 @@
type Request=record {url:string;text:string;version:int32;};
interface DeviceController id "device-controller" revision "device-controller@1" {
queryable portable value enabled id "controller:enabled" : bool {get id "controller:enabled:get" execution snapshot targets [server];}
operation snapshot id "device:snapshot" : unit -> optional<Request> {call id "device:snapshot:call" execution snapshot targets [server];}
operation apply id "device:apply" : optional<Request> -> unit {call id "device:apply:call" execution remote;}
}
+15
View File
@@ -0,0 +1,15 @@
import interface Device;
import interface DeviceController;
external atom Display id "device:display";
type Request=record {url:string;text:string;version:int32;};
package Driver id "driver" revision "driver@1" {
function create id "driver:create" : string -> atom-ref<Display> execution transaction targets [browser,server] requires {creation device id "device" : Display input record {enabled:bool;requested:Request;observed:optional<Request>;};};
operation request id "driver:request" : string -> unit mode call execution transaction targets [browser,server] receiver any requires {state requested id "requested" : Request [read,write];};
operation snapshot id "driver:snapshot" : unit -> optional<Request> mode call execution snapshot targets [server] receiver any requires {interface data id "data" : Device using [enabled.get,requested.get,observed.get];};
operation recordObservation id "driver:record" : Request -> unit mode call execution transaction targets [server] receiver any requires {state requested id "requested" : Request [read];state observed id "observed" : optional<Request> [write];};
operation apply id "driver:apply" : optional<Request> -> unit mode call execution remote receiver any requires {interface device id "device" : Device using [recordObservation.call];};
operation enabled id "driver:enabled" : unit -> bool mode call execution snapshot targets [server] receiver any requires {interface data id "data" : Device using [enabled.get];};
query Enabled id "enabled" root workspace DeviceController document "enabled.graphql" operation "Enabled" {max rows 64;}
query Inputs id "inputs" root Device document "inputs.graphql" operation "Inputs" {replica;}
query View id "view" root Device document "inputs.graphql" operation "Inputs" {local from Inputs;watch;}
}
+1
View File
@@ -0,0 +1 @@
query Enabled {root {objects(all:64, where:{enabled:{eq:true}}) {entries {node {_qx {ref}}}}}}
+1
View File
@@ -0,0 +1 @@
query Inputs {root {enabled requested {url text version} observed {url text version}}}
+25
View File
@@ -0,0 +1,25 @@
workspace Controllers id "workspace:controllers" revision "workspace:controllers@1" commit "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" {
import interface Device;
import interface DeviceController;
import package Driver;
atom Display id "device:display";
conform Display as Device id "display:device" {
private state Enabled id "display:enabled" on Display : bool policy register;
private state Requested id "display:requested" on Display : record {url:string;text:string;version:int32;} policy register;
private state Observed id "display:observed" on Display : optional<record {url:string;text:string;version:int32;}> policy register;
initialize {enabled to state Enabled;requested to state Requested;observed to state Observed;};
bind create.call to package Driver.create with {device to creation Display with {Device from input;};};
bind enabled.get to state Enabled.read;
bind enabled.set to state Enabled.write;
bind requested.get to state Requested.read;
bind observed.get to state Observed.read;
bind requestText.call to package Driver.request with {requested to state Requested;};
bind recordObservation.call to package Driver.recordObservation with {requested to state Requested;observed to state Observed;};
bind remove.call to lifecycle.delete;
}
conform Display as DeviceController id "display:controller" {
bind enabled.get to package Driver.enabled with {data to interface Device;};
bind snapshot.call to package Driver.snapshot with {data to interface Device;};
bind apply.call to package Driver.apply with {device to interface Device;};
}
}