@phreshos/client 0.1.32 → 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 +23 -13
- package/dist/appearance.d.ts +3 -1
- package/dist/appearance.js +3 -0
- package/dist/context.d.ts +8 -28
- package/dist/context.js +9 -8
- package/dist/desktop/desktop.d.ts +3 -13
- package/dist/desktop/desktop.js +4 -4
- package/dist/desktop/preferences.d.ts +3 -3
- package/dist/desktop/preferences.js +1 -1
- package/dist/desktop/surface.d.ts +3 -2
- package/dist/desktop/surface.js +1 -1
- package/dist/domain.d.ts +37 -88
- package/dist/domain.js +90 -64
- package/dist/events.d.ts +5 -7
- package/dist/events.js +6 -6
- package/dist/main.d.ts +4 -4
- package/dist/main.js +2 -2
- package/dist/permissions.d.ts +7 -10
- package/dist/permissions.js +34 -21
- package/dist/service.js +3 -3
- package/dist/startup.d.ts +4 -0
- package/dist/startup.js +16 -0
- package/dist/storage.d.ts +9 -5
- package/dist/storage.js +59 -8
- package/dist/system.d.ts +3 -27
- package/dist/system.js +67 -3
- package/dist/uploads.d.ts +1 -0
- package/dist/uploads.js +6 -0
- package/dist/wire.d.ts +2 -3
- package/dist/wire.js +16 -6
- package/package.json +3 -3
- package/dist/desktop/pointer.d.ts +0 -11
- package/dist/desktop/pointer.js +0 -59
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
|
|
6
|
-
|
|
7
|
-
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
|
|
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,
|
|
39
|
-
|
|
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
|
|
48
|
-
const
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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.
|
package/dist/appearance.d.ts
CHANGED
|
@@ -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
|
}
|
package/dist/appearance.js
CHANGED
|
@@ -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 {
|
|
2
|
-
import {
|
|
3
|
-
/** The executing Process's canonical Server handle. */
|
|
4
|
-
export type ContextServer<Events extends object = {}, Fallback = unknown> =
|
|
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
|
-
|
|
12
|
-
|
|
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 {
|
|
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 {
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
class ContextServerHandle extends
|
|
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");
|
|
@@ -54,7 +54,7 @@ function owner() {
|
|
|
54
54
|
return ownerPromise;
|
|
55
55
|
}
|
|
56
56
|
contextServer = new ContextServerHandle(owner);
|
|
57
|
-
class ContextClientHandle extends
|
|
57
|
+
class ContextClientHandle extends ClientEndpointBase {
|
|
58
58
|
owner;
|
|
59
59
|
traffic = new TrafficHandle(null, "client");
|
|
60
60
|
lifecycle = endpointLifecycle(currentAddress, "client");
|
|
@@ -83,7 +83,8 @@ contextClient = new ContextClientHandle(owner);
|
|
|
83
83
|
class ClientContext extends Events {
|
|
84
84
|
server = contextServer;
|
|
85
85
|
window = contextClient.window;
|
|
86
|
-
|
|
86
|
+
localWindow = localWindow(currentAddress);
|
|
87
|
+
permissions = contextPermissions();
|
|
87
88
|
constructor() {
|
|
88
89
|
super((event, listener, impossible) => wire.on("end-end", event, value => listener(contextMessage(value)), null, impossible), (listener, impossible) => wire.onAll("end-end", (event, value) => {
|
|
89
90
|
if (typeof event === "string")
|
|
@@ -116,5 +117,5 @@ function contextMessage(value) {
|
|
|
116
117
|
const raw = value;
|
|
117
118
|
return { from: visibleEndpoint(raw.from), payload: raw.payload };
|
|
118
119
|
}
|
|
119
|
-
/** Inbound events, owner hierarchy, and paired Server for this Client runtime. */
|
|
120
|
+
/** Inbound events, owner hierarchy, and paired Server Endpoint for this Client runtime. */
|
|
120
121
|
export const context = new ClientContext();
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
/**
|
|
3
|
-
export
|
|
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;
|
package/dist/desktop/desktop.js
CHANGED
|
@@ -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
|
-
|
|
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;
|
package/dist/desktop/surface.js
CHANGED
|
@@ -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 {
|
|
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
|
-
|
|
48
|
-
export type
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
59
|
export type TrafficCapture<Events extends object = {}, Fallback = unknown> = CoreTrafficCapture<Events, Endpoint | null, Fallback>;
|
|
88
|
-
/** Question
|
|
89
|
-
export type AskMessage<Payload = unknown> = CoreAskMessage<Payload,
|
|
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,
|
|
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,
|
|
94
|
-
/** Answer
|
|
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 = unknown> = CoreEndpointTraffic<Events, Endpoint | null,
|
|
102
|
-
/** Directed communication originating from one client-visible Server. */
|
|
103
|
-
export type ServerTraffic<Events extends object = {}, Fallback = unknown> = CoreServerTraffic<Events, Endpoint | null,
|
|
104
|
-
/** Directed communication originating from one client-visible Client. */
|
|
105
|
-
export type ClientTraffic<Events extends object = {}, Fallback = unknown> = CoreClientTraffic<Events, Endpoint | null,
|
|
106
|
-
|
|
107
|
-
export type
|
|
108
|
-
|
|
109
|
-
|
|
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 = unknown> = 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 = unknown> = 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:
|
|
91
|
+
to: ServerEndpoint<{}, unknown> | null;
|
|
144
92
|
payload: unknown;
|
|
145
93
|
}>;
|
|
146
94
|
}>>;
|
|
@@ -159,23 +107,24 @@ export declare class ServerTrafficHandle extends TrafficHandle {
|
|
|
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?:
|
|
173
|
-
client?:
|
|
120
|
+
server?: ServerEndpoint;
|
|
121
|
+
client?: ClientEndpoint;
|
|
174
122
|
}): Process;
|
|
175
123
|
export declare function endpoint(reference: EndpointReference | undefined): Endpoint;
|
|
176
124
|
export declare function claimEndpoint(reference: string, kind: "server" | "client", endpoint: Endpoint): Endpoint<{}, unknown>;
|
|
177
125
|
export declare function window(target: WindowTarget): Window;
|
|
178
|
-
|
|
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
|
|
188
|
-
/** Runtime constructor shared by all client-visible Client handles. */
|
|
189
|
-
export declare const
|
|
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 {};
|