@phreshos/client 0.1.31 → 0.1.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  The SDK for a PhreshOS Program's Client Endpoint.
4
4
 
5
- The Client SDK adapts the sandboxed desktop boundary to the shared Core domain
6
- model. It exposes the restricted `system` and `context` available inside a
7
- Client without redefining Program, Process, Endpoint, Server, or Client.
5
+ The Client SDK adapts the Desktop boundary to the shared Core domain model. It
6
+ exposes the same complete `system` contract as the Server and Node SDKs, the
7
+ current Client `context`, and the Client's `desktop` environment.
8
8
 
9
9
  ## Installation
10
10
 
@@ -31,12 +31,14 @@ context.publish("changed", { value: 1 })
31
31
  const program = await context.program()
32
32
  const process = await context.process()
33
33
  const server = context.server
34
- const window = context.window
34
+ const position = await context.window.position()
35
+ await context.localWindow.move({ x: 20, y: 20 })
35
36
  ```
36
37
 
37
38
  `context` belongs to the executing Client. It provides communication,
38
- navigation to its Program and Process, its paired Server, its Window, and
39
- Client-owned capabilities.
39
+ navigation to its Program and Process, its paired Server, the authoritative
40
+ current Window through `window`, and command-only control of the current
41
+ Desktop representation through `localWindow`.
40
42
 
41
43
  ## System
42
44
 
@@ -44,15 +46,23 @@ Client-owned capabilities.
44
46
  import { system } from "@phreshos/client"
45
47
 
46
48
  const appearance = await system.appearance.snapshot()
47
- const surface = await system.desktop.surface.snapshot()
48
- const pointer = await system.desktop.pointer.snapshot()
49
- const preferences = await system.desktop.preferences.snapshot()
49
+ const programs = await system.program.list()
50
+ const processes = await system.process.list()
50
51
  ```
51
52
 
52
- The Client System exposes only capabilities allowed by the desktop boundary:
53
- read-only Appearance, desktop surface and pointer state, writable desktop
54
- preferences, uploads, Fetch, and exact Service handles. It does not expose
55
- system-wide Program or Process registries.
53
+ `system` is the complete global System contract sourced from Core.
54
+
55
+ ## Desktop
56
+
57
+ ```ts
58
+ import { desktop } from "@phreshos/client"
59
+
60
+ const surface = await desktop.surface.snapshot()
61
+ const preferences = await desktop.preferences.snapshot()
62
+ ```
63
+
64
+ Desktop capabilities remain separate from the global System and the current
65
+ execution Context.
56
66
 
57
67
  Requests read current state. Subscriptions observe future publications and do
58
68
  not replay an initial value. Importing the SDK performs neither operation.
@@ -1,6 +1,7 @@
1
+ import { type Appearance, type AppearanceEvents, type WritableAppearance } from "@phreshos/core";
1
2
  import Events from "./events.js";
2
3
  /** Read-only System Appearance reached through the Desktop boundary. */
3
- export default class ClientAppearance extends Events {
4
+ export default class ClientAppearance extends Events<AppearanceEvents, never> implements WritableAppearance {
4
5
  constructor();
5
6
  snapshot(): Promise<Readonly<{
6
7
  background: import("@phreshos/core").ThemedValue<string, string>;
@@ -12,4 +13,5 @@ export default class ClientAppearance extends Events {
12
13
  signInWallpaper: import("@phreshos/core").ThemedValue<string | null, string | null>;
13
14
  desktopWallpaper: import("@phreshos/core").ThemedValue<string | null, string | null>;
14
15
  }>>;
16
+ update(appearance: Appearance): Promise<void>;
15
17
  }
@@ -15,4 +15,7 @@ export default class ClientAppearance extends Events {
15
15
  const [appearance] = await wire.request(["appearance"]);
16
16
  return createAppearanceSnapshot(appearance);
17
17
  }
18
+ async update(appearance) {
19
+ await wire.request(["updateAppearance", appearance]);
20
+ }
18
21
  }
package/dist/context.d.ts CHANGED
@@ -1,33 +1,13 @@
1
- import type { Context as CoreContext, ContextCapture as CoreContextCapture, ContextEvents as CoreContextEvents, ContextMessage as CoreContextMessage } from "@phreshos/core";
2
- import { Server, type Endpoint, type Process, type Program, type Window } from "./domain.js";
3
- /** The executing Process's canonical Server handle. */
4
- export type ContextServer<Events extends object = {}, Fallback = never> = Server<Events, Fallback>;
5
- /** One value addressed to the current Client, with a client-visible sender. */
1
+ import type { ClientContext as CoreClientContext, ContextCapture as CoreContextCapture, ContextEvents as CoreContextEvents, ContextMessage as CoreContextMessage } from "@phreshos/core";
2
+ import { ServerEndpoint, type Endpoint } from "./domain.js";
3
+ /** The executing Process's canonical Server Endpoint handle. */
4
+ export type ContextServer<Events extends object = {}, Fallback = unknown> = ServerEndpoint<Events, Fallback>;
5
+ /** One value addressed to the current Client Endpoint, with a client-visible sender. */
6
6
  export type ContextMessage<Payload = unknown> = CoreContextMessage<Payload, Endpoint | null>;
7
7
  /** Applies the client-visible sender envelope to known Context events. */
8
8
  export type ContextEvents<Events extends object> = CoreContextEvents<Events, Endpoint | null>;
9
- /** Every event observable through the current Client Context. */
9
+ /** Every event observable through the current Client Endpoint Context. */
10
10
  export type ContextCapture<Events extends object = {}> = CoreContextCapture<Events, Endpoint | null>;
11
- /** Client runtime context: inbound communication, owner hierarchy, and paired Server. */
12
- export interface Context<Events extends object = {}> extends CoreContext<Events, Endpoint | null> {
13
- /** The same Server handle exposed by the executing Process. */
14
- readonly server: ContextServer;
15
- /** Presentation capability of the executing Client. */
16
- readonly window: Window;
17
- /** The same permission capability exposed by the executing Program. */
18
- readonly permission: Program["permission"];
19
- /** Returns the Process represented by this Client. */
20
- process(): Promise<Process>;
21
- /** Returns the executing Process's Program-local name, or `null` when unnamed. */
22
- name(): Promise<string | null>;
23
- /** Returns the accessible parent Process, or `null` when none exists. */
24
- parent(): Promise<Process | null>;
25
- /** Returns the Program that owns this Client. */
26
- program(): Promise<Program>;
27
- /** Returns one immutable option supplied when this Process was created. */
28
- option(name: string): Promise<string | undefined>;
29
- /** Stops the executing Client; rejects when it is the final live Endpoint. */
30
- stop(): Promise<void>;
31
- }
32
- /** Inbound events, owner hierarchy, and paired Server for this Client runtime. */
11
+ export type Context<Events extends object = {}> = CoreClientContext<Events>;
12
+ /** Inbound events, owner hierarchy, and paired Server Endpoint for this Client runtime. */
33
13
  export declare const context: Context;
package/dist/context.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import Deadline from "./deadline.js";
2
- import { Client, Server, ServerTrafficHandle, TrafficHandle, bindEvents, endpointLifecycle, endpointEvents, process, program, visibleEndpoint, window as windowHandle } from "./domain.js";
2
+ import { ClientEndpoint, ServerEndpoint, ServerTrafficHandle, TrafficHandle, bindEvents, endpointLifecycle, endpointEvents, process, program, visibleEndpoint, localWindow, window as windowHandle, } from "./domain.js";
3
3
  import Events from "./events.js";
4
4
  import wire from "./wire.js";
5
- import { currentProgramPermission } from "./permissions.js";
6
- const ServerBase = Server;
7
- const ClientBase = Client;
8
- class ContextServerHandle extends ServerBase {
5
+ import { contextPermissions } from "./permissions.js";
6
+ const ServerEndpointBase = ServerEndpoint;
7
+ const ClientEndpointBase = ClientEndpoint;
8
+ class ContextServerHandle extends ServerEndpointBase {
9
9
  owner;
10
10
  traffic = new ServerTrafficHandle(null, "server");
11
11
  lifecycle = endpointLifecycle(currentAddress, "server");
@@ -23,7 +23,7 @@ class ContextServerHandle extends ServerBase {
23
23
  async start(launch = {}) { await wire.request(["start-endpoint", undefined, "server", launch]); }
24
24
  async stop() { await wire.request(["stop-endpoint", undefined, "server"]); }
25
25
  async isService() { return (await wire.request(["is-service", "server"]))[0]; }
26
- async waitReady(timeout) { await wire.request(["wait-ready"], timeout); }
26
+ async waitReady(timeout) { await wire.request(["wait-ready", undefined, "server"], timeout); }
27
27
  async ask(event, payload = undefined) {
28
28
  return this.askWithin(undefined, event, payload);
29
29
  }
@@ -32,7 +32,7 @@ class ContextServerHandle extends ServerBase {
32
32
  }
33
33
  async askWithin(timeout, event, payload) {
34
34
  const deadline = new Deadline(timeout);
35
- await wire.requestWithin(["wait-ready", null, true], deadline);
35
+ await wire.requestWithin(["wait-ready", undefined, "server", true], deadline);
36
36
  return await wire.askServerWithin(event, payload, deadline);
37
37
  }
38
38
  }
@@ -54,7 +54,7 @@ function owner() {
54
54
  return ownerPromise;
55
55
  }
56
56
  contextServer = new ContextServerHandle(owner);
57
- class ContextClientHandle extends ClientBase {
57
+ class ContextClientHandle extends ClientEndpointBase {
58
58
  owner;
59
59
  traffic = new TrafficHandle(null, "client");
60
60
  lifecycle = endpointLifecycle(currentAddress, "client");
@@ -77,12 +77,14 @@ class ContextClientHandle extends ClientBase {
77
77
  async start(launch = {}) { await wire.request(["start-endpoint", undefined, "client", launch]); }
78
78
  async stop() { await wire.request(["stop-endpoint", undefined, "client"]); }
79
79
  async isService() { return (await wire.request(["is-service", "client"]))[0]; }
80
+ async waitReady(timeout) { await wire.request(["wait-ready", undefined, "client"], timeout); }
80
81
  }
81
82
  contextClient = new ContextClientHandle(owner);
82
83
  class ClientContext extends Events {
83
84
  server = contextServer;
84
85
  window = contextClient.window;
85
- permission = currentProgramPermission;
86
+ localWindow = localWindow(currentAddress);
87
+ permissions = contextPermissions();
86
88
  constructor() {
87
89
  super((event, listener, impossible) => wire.on("end-end", event, value => listener(contextMessage(value)), null, impossible), (listener, impossible) => wire.onAll("end-end", (event, value) => {
88
90
  if (typeof event === "string")
@@ -115,5 +117,5 @@ function contextMessage(value) {
115
117
  const raw = value;
116
118
  return { from: visibleEndpoint(raw.from), payload: raw.payload };
117
119
  }
118
- /** Inbound events, owner hierarchy, and paired Server for this Client runtime. */
120
+ /** Inbound events, owner hierarchy, and paired Server Endpoint for this Client runtime. */
119
121
  export const context = new ClientContext();
@@ -1,13 +1,3 @@
1
- import type { DesktopPointerSource, DesktopSurfaceSource, WritableDesktopPreferencesSource } from "@phreshos/core";
2
- /** Every capability owned by the Desktop containing this Client. */
3
- export interface SystemDesktop {
4
- readonly surface: DesktopSurfaceSource;
5
- readonly pointer: DesktopPointerSource;
6
- readonly preferences: WritableDesktopPreferencesSource;
7
- }
8
- /** Desktop access bound to the current Client Process boundary. */
9
- export default class ClientDesktop implements SystemDesktop {
10
- readonly surface: DesktopSurfaceSource;
11
- readonly pointer: DesktopPointerSource;
12
- readonly preferences: WritableDesktopPreferencesSource;
13
- }
1
+ import type { Desktop } from "@phreshos/core";
2
+ /** The Desktop environment containing this Client Endpoint. */
3
+ export declare const desktop: Desktop;
@@ -1,9 +1,9 @@
1
- import ClientPointer from "./pointer.js";
2
1
  import ClientPreferences from "./preferences.js";
3
2
  import ClientSurface from "./surface.js";
4
- /** Desktop access bound to the current Client Process boundary. */
5
- export default class ClientDesktop {
3
+ /** Desktop access bound to the current Client Endpoint's Process boundary. */
4
+ class ClientDesktop {
6
5
  surface = new ClientSurface();
7
- pointer = new ClientPointer();
8
6
  preferences = new ClientPreferences();
9
7
  }
8
+ /** The Desktop environment containing this Client Endpoint. */
9
+ export const desktop = new ClientDesktop();
@@ -1,7 +1,7 @@
1
- import type { DesktopPreferencesUpdate } from "@phreshos/core";
1
+ import type { DesktopPreferencesEvents, DesktopPreferencesUpdate, WritableDesktopPreferencesSource } from "@phreshos/core";
2
2
  import Events from "../events.js";
3
- /** Effective preferences owned by the Desktop containing this Client. */
4
- export default class ClientPreferences extends Events {
3
+ /** Effective preferences owned by the Desktop containing this Client Endpoint. */
4
+ export default class ClientPreferences extends Events<DesktopPreferencesEvents, never> implements WritableDesktopPreferencesSource {
5
5
  constructor();
6
6
  snapshot(): Promise<Readonly<{
7
7
  theme: import("@phreshos/core").Theme;
@@ -1,6 +1,6 @@
1
1
  import Events from "../events.js";
2
2
  import wire from "../wire.js";
3
- /** Effective preferences owned by the Desktop containing this Client. */
3
+ /** Effective preferences owned by the Desktop containing this Client Endpoint. */
4
4
  export default class ClientPreferences extends Events {
5
5
  constructor() {
6
6
  super((event, listener, impossible) => wire.on("host-desktop-preferences", event, value => {
@@ -1,6 +1,7 @@
1
+ import type { DesktopSurfaceEvents, DesktopSurfaceSource } from "@phreshos/core";
1
2
  import Events from "../events.js";
2
- /** Read-only access to the Desktop surface containing this Client. */
3
- export default class ClientSurface extends Events {
3
+ /** Read-only access to the Desktop surface containing this Client Endpoint. */
4
+ export default class ClientSurface extends Events<DesktopSurfaceEvents, never> implements DesktopSurfaceSource {
4
5
  constructor();
5
6
  snapshot(): Promise<Readonly<{
6
7
  size: import("@phreshos/core").DesktopSize;
@@ -1,6 +1,6 @@
1
1
  import Events from "../events.js";
2
2
  import wire from "../wire.js";
3
- /** Read-only access to the Desktop surface containing this Client. */
3
+ /** Read-only access to the Desktop surface containing this Client Endpoint. */
4
4
  export default class ClientSurface extends Events {
5
5
  constructor() {
6
6
  super((event, listener, impossible) => wire.on("host-desktop-surface", event, value => {
package/dist/domain.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Client as CoreClient, Endpoint as CoreEndpoint, Process as CoreProcess, Program as CoreProgram, Server as CoreServer, type AnswerCapture as CoreAnswerCapture, type AnswerMessage as CoreAnswerMessage, type AnswerSubscriber as CoreAnswerSubscriber, type AskCapture as CoreAskCapture, type AskMessage as CoreAskMessage, type AskSubscriber as CoreAskSubscriber, type Cleanup, type ClientTraffic as CoreClientTraffic, type ClientDeclaration, type EndpointTraffic as CoreEndpointTraffic, type Exit, type EventOptions, type Launch, type LocalWindow, type Outcome, type Permission, type Position, type ProgramProcess as CoreProgramProcess, type ServerTraffic as CoreServerTraffic, type Size, type TrafficMessage as CoreTrafficMessage, type TrafficCapture as CoreTrafficCapture, type TrafficEvents as CoreTrafficEvents, type Window as CoreWindow, type WindowState } from "@phreshos/core";
1
+ import { ClientEndpoint as CoreClientEndpoint, Endpoint as CoreEndpoint, Process as CoreProcess, Program as CoreProgram, ServerEndpoint as CoreServerEndpoint, type AnswerCapture as CoreAnswerCapture, type AnswerMessage as CoreAnswerMessage, type AnswerSubscriber as CoreAnswerSubscriber, type AskCapture as CoreAskCapture, type AskMessage as CoreAskMessage, type AskSubscriber as CoreAskSubscriber, type Cleanup, type ClientTraffic as CoreClientTraffic, type ClientDeclaration, type EndpointTraffic as CoreEndpointTraffic, type Exit, type EventOptions, type LocalWindow, type Outcome, type Position, type ProgramProcess as CoreProgramProcess, type ProgramProcessRunEvent as CoreProgramProcessRunEvent, type ProgramProcessRunOptions as CoreProgramProcessRunOptions, type ServerTraffic as CoreServerTraffic, type Size, type TrafficMessage as CoreTrafficMessage, type TrafficCapture as CoreTrafficCapture, type TrafficEvents as CoreTrafficEvents, type Window as CoreWindow, type WindowState } from "@phreshos/core";
2
2
  import Events from "./events.js";
3
3
  export interface HandleAddress {
4
4
  identity: string;
@@ -14,10 +14,12 @@ export interface ClientDeclarationRecord extends EndpointDeclarationRecord {
14
14
  position: Position | null;
15
15
  layer: ClientDeclaration["layer"];
16
16
  minimize: boolean | null;
17
+ permissions: ClientDeclaration["permissions"];
17
18
  }
18
19
  export interface ProgramRecord {
19
20
  reference: string;
20
21
  identity: string;
22
+ assetId: string;
21
23
  installed?: boolean;
22
24
  name: string;
23
25
  version: string | null;
@@ -44,93 +46,39 @@ export interface EndpointReference {
44
46
  process: ProcessRecord;
45
47
  }
46
48
  export type WindowRecord = WindowState;
47
- /** Program handle visible inside a structurally isolated Client. */
48
- export type Program = Omit<CoreProgram, "process"> & {
49
- /** Effective permission decisions owned by this Program. */
50
- readonly permission: Permission;
51
- /** Operations and lifecycle observation for this Program's Processes. */
52
- readonly process: ProgramProcess;
53
- };
54
- /** Client-visible Process operations scoped to one Program. */
55
- export type ProgramProcess = Omit<CoreProgramProcess, "list" | "first" | "last" | "find" | "create" | "findOrCreate"> & {
56
- /** Returns every live Process of this Program visible to the current Client. */
57
- list(): Promise<Process[]>;
58
- /** Returns the earliest-started visible live Process, or `null` when none exist. */
59
- first(): Promise<Process | null>;
60
- /** Returns the latest-started visible live Process, or `null` when none exist. */
61
- last(): Promise<Process | null>;
62
- /** Finds a visible live Process by runtime identity or Program-local name. */
63
- find(identityOrName: string): Promise<Process | null>;
64
- /** Creates one Process of this same Program. */
65
- create(launch?: Launch): Promise<Process>;
66
- /** Finds the named Process or atomically creates it with the same resolved launch. */
67
- findOrCreate(launch: Launch & Readonly<{
68
- name: string;
69
- }>): Promise<Process>;
70
- };
71
- /** Process handle visible inside a structurally isolated Client. */
72
- export type Process = Omit<CoreProcess, "server" | "client" | "program" | "parent"> & {
73
- /** Permanent handle to this Process's Server. */
74
- readonly server: Server;
75
- /** Permanent handle to this Process's Client. */
76
- readonly client: Client;
77
- /** Returns the Program that owns this Process. */
78
- program(): Program;
79
- /** Returns the visible parent Process, or `null` when no parent is accessible. */
80
- parent(): Promise<Process | null>;
81
- };
82
- /** Traffic value with identities hidden when they cross the Client boundary. */
49
+ export type Program = CoreProgram;
50
+ export type ProgramProcess = CoreProgramProcess;
51
+ export type ProgramProcessRunEvent = CoreProgramProcessRunEvent;
52
+ export type ProgramProcessRunOptions = CoreProgramProcessRunOptions;
53
+ export type Process = CoreProcess;
54
+ /** Traffic value resolved to the same global Endpoint handles as the System. */
83
55
  export type TrafficMessage<Payload = unknown> = CoreTrafficMessage<Payload, Endpoint | null>;
84
56
  /** Applies client-visible destination metadata to known traffic events. */
85
57
  export type TrafficEvents<Events extends object> = CoreTrafficEvents<Events, Endpoint | null>;
86
58
  /** Every ordinary event observable in client-visible Endpoint traffic. */
87
- export type TrafficCapture<Events extends object = {}, Fallback = never> = CoreTrafficCapture<Events, Endpoint | null, Fallback>;
88
- /** Question with a Server destination hidden when it crosses the Client boundary. */
89
- export type AskMessage<Payload = unknown> = CoreAskMessage<Payload, Server | null>;
59
+ export type TrafficCapture<Events extends object = {}, Fallback = unknown> = CoreTrafficCapture<Events, Endpoint | null, Fallback>;
60
+ /** Question carrying its globally resolved Server Endpoint destination. */
61
+ export type AskMessage<Payload = unknown> = CoreAskMessage<Payload, ServerEndpoint | null>;
90
62
  /** One question observable in client-visible Endpoint traffic. */
91
- export type AskCapture<Payload = unknown> = CoreAskCapture<Payload, Server | null>;
63
+ export type AskCapture<Payload = unknown> = CoreAskCapture<Payload, ServerEndpoint | null>;
92
64
  /** Callback that observes questions sent by a client-visible Endpoint. */
93
- export type AskSubscriber<Payload = unknown> = CoreAskSubscriber<Payload, Server | null>;
94
- /** Answer with an Endpoint destination hidden when it crosses the Client boundary. */
65
+ export type AskSubscriber<Payload = unknown> = CoreAskSubscriber<Payload, ServerEndpoint | null>;
66
+ /** Answer carrying its globally resolved Endpoint destination. */
95
67
  export type AnswerMessage<Result = unknown> = CoreAnswerMessage<Result, Endpoint | null>;
96
- /** One answer observable in client-visible Server traffic. */
68
+ /** One answer observable in client-visible Server Endpoint traffic. */
97
69
  export type AnswerCapture<Result = unknown> = CoreAnswerCapture<Result, Endpoint | null>;
98
- /** Callback that observes answers sent by a client-visible Server. */
70
+ /** Callback that observes answers sent by a client-visible Server Endpoint. */
99
71
  export type AnswerSubscriber<Result = unknown> = CoreAnswerSubscriber<Result, Endpoint | null>;
100
72
  /** Directed communication originating from one client-visible Endpoint. */
101
- export type EndpointTraffic<Events extends object = {}, Fallback = never> = CoreEndpointTraffic<Events, Endpoint | null, Server | null, Fallback>;
102
- /** Directed communication originating from one client-visible Server. */
103
- export type ServerTraffic<Events extends object = {}, Fallback = never> = CoreServerTraffic<Events, Endpoint | null, Server | null, Fallback>;
104
- /** Directed communication originating from one client-visible Client. */
105
- export type ClientTraffic<Events extends object = {}, Fallback = never> = CoreClientTraffic<Events, Endpoint | null, Server | null, Fallback>;
106
- /** Common Endpoint handle visible inside a structurally isolated Client. */
107
- export type Endpoint<Events extends object = {}, Fallback = never> = Omit<CoreEndpoint<Events, Fallback>, "process" | "traffic"> & {
108
- /** Directed communication originating from this Endpoint. */
109
- readonly traffic: EndpointTraffic<Events, Fallback>;
110
- /** Returns the Process that owns this Endpoint. */
111
- process(): Promise<Process>;
112
- };
113
- /** Server handle visible inside a structurally isolated Client. */
114
- export type Server<Events extends object = {}, Fallback = never> = Omit<CoreServer<Events, Fallback>, "process" | "traffic"> & Endpoint<Events, Fallback> & {
115
- /** Directed communication originating from this Server. */
116
- readonly traffic: ServerTraffic<Events, Fallback>;
117
- /** Returns the Process that owns this Server. */
118
- process(): Promise<Process>;
119
- };
120
- /** Client handle visible inside a structurally isolated Client. */
121
- export type Client<Events extends object = {}, Fallback = never> = Omit<CoreClient<Events, Fallback>, "process" | "traffic" | "window"> & Endpoint<Events, Fallback> & {
122
- /** Directed communication originating from this Client. */
123
- readonly traffic: ClientTraffic<Events, Fallback>;
124
- /** Presentation capability permanently owned by this Client handle. */
125
- readonly window: Window;
126
- /** Returns the Process that owns this Client. */
127
- process(): Promise<Process>;
128
- };
129
- /** Authoritative Window state plus its representation on this desktop. */
130
- export type Window = CoreWindow & {
131
- /** Physical representation of this Window on the current desktop. */
132
- readonly local: LocalWindow;
133
- };
73
+ export type EndpointTraffic<Events extends object = {}, Fallback = unknown> = CoreEndpointTraffic<Events, Endpoint | null, ServerEndpoint | null, Fallback>;
74
+ /** Directed communication originating from one client-visible Server Endpoint. */
75
+ export type ServerTraffic<Events extends object = {}, Fallback = unknown> = CoreServerTraffic<Events, Endpoint | null, ServerEndpoint | null, Fallback>;
76
+ /** Directed communication originating from one client-visible Client Endpoint. */
77
+ export type ClientTraffic<Events extends object = {}, Fallback = unknown> = CoreClientTraffic<Events, Endpoint | null, ServerEndpoint | null, Fallback>;
78
+ export type Endpoint<Events extends object = {}, Fallback = unknown> = CoreEndpoint<Events, Fallback>;
79
+ export type ServerEndpoint<Events extends object = {}, Fallback = unknown> = CoreServerEndpoint<Events, Fallback>;
80
+ export type ClientEndpoint<Events extends object = {}, Fallback = unknown> = CoreClientEndpoint<Events, Fallback>;
81
+ export type Window = CoreWindow;
134
82
  export declare class TrafficHandle extends Events {
135
83
  protected readonly target: HandleAddress | null;
136
84
  protected readonly kind: "server" | "client";
@@ -140,7 +88,7 @@ export declare class TrafficHandle extends Events {
140
88
  event: string;
141
89
  questionId: string;
142
90
  message: Readonly<{
143
- to: Server<{}, never> | null;
91
+ to: ServerEndpoint<{}, unknown> | null;
144
92
  payload: unknown;
145
93
  }>;
146
94
  }>>;
@@ -152,30 +100,31 @@ export declare class ServerTrafficHandle extends TrafficHandle {
152
100
  event: string;
153
101
  questionId: string;
154
102
  message: Readonly<{
155
- to: Endpoint<{}, never> | null;
103
+ to: Endpoint<{}, unknown> | null;
156
104
  outcome: Outcome<unknown>;
157
105
  }>;
158
106
  }>>;
159
107
  private followAnswers;
160
108
  }
161
109
  type WindowTarget = () => Promise<HandleAddress>;
162
- export declare function scoped(route: string, subject: string | null, convert: (event: string, values: unknown[]) => unknown): Events;
110
+ export declare function scoped(route: string, subject: string | null, convert: (event: string, values: unknown[]) => unknown): Events<{}, unknown>;
163
111
  /** Destinationless events originating from one Endpoint handle. */
164
- export declare function endpointEvents(target: HandleAddress | null, half: "server" | "client"): Events;
112
+ export declare function endpointEvents(target: HandleAddress | null, half: "server" | "client"): Events<{}, unknown>;
165
113
  /** Start and stop transitions belonging directly to one permanent Endpoint. */
166
- export declare function endpointLifecycle(target: WindowTarget, half: "server" | "client"): Events;
114
+ export declare function endpointLifecycle(target: WindowTarget, half: "server" | "client"): Events<{}, unknown>;
167
115
  export declare function exit(code: unknown, signal: unknown): Exit;
168
116
  export declare function trafficMessage(value: unknown): TrafficMessage;
169
117
  export declare function bindEvents(target: object, events: Events): void;
170
118
  export declare function program(record: ProgramRecord): Program;
171
119
  export declare function process(record: ProcessRecord, endpoints?: {
172
- server?: Server;
173
- client?: Client;
120
+ server?: ServerEndpoint;
121
+ client?: ClientEndpoint;
174
122
  }): Process;
175
123
  export declare function endpoint(reference: EndpointReference | undefined): Endpoint;
176
- export declare function claimEndpoint(reference: string, kind: "server" | "client", endpoint: Endpoint): Endpoint<{}, never>;
124
+ export declare function claimEndpoint(reference: string, kind: "server" | "client", endpoint: Endpoint): Endpoint<{}, unknown>;
177
125
  export declare function window(target: WindowTarget): Window;
178
- /** Resolves only endpoint identities intentionally visible to this Client. */
126
+ export declare function localWindow(target: WindowTarget): LocalWindow;
127
+ /** Resolves an Endpoint reference through the Client Endpoint's global handle registry. */
179
128
  export declare function visibleEndpoint(reference: EndpointReference | null | undefined): Endpoint | null;
180
129
  /** Runtime constructor shared by all client-visible Program handles. */
181
130
  export declare const Program: typeof CoreProgram;
@@ -183,8 +132,8 @@ export declare const Program: typeof CoreProgram;
183
132
  export declare const Process: typeof CoreProcess;
184
133
  /** Runtime constructor shared by all client-visible Endpoint handles. */
185
134
  export declare const Endpoint: typeof CoreEndpoint;
186
- /** Runtime constructor shared by all client-visible Server handles. */
187
- export declare const Server: typeof CoreServer;
188
- /** Runtime constructor shared by all client-visible Client handles. */
189
- export declare const Client: typeof CoreClient;
135
+ /** Runtime constructor shared by all client-visible Server Endpoint handles. */
136
+ export declare const ServerEndpoint: typeof CoreServerEndpoint;
137
+ /** Runtime constructor shared by all client-visible Client Endpoint handles. */
138
+ export declare const ClientEndpoint: typeof CoreClientEndpoint;
190
139
  export {};