@phreshos/client 0.1.24 → 0.1.25
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 +17 -17
- package/dist/{current.d.ts → context.d.ts} +11 -11
- package/dist/{current.js → context.js} +12 -12
- package/dist/main.d.ts +1 -1
- package/dist/main.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -51,17 +51,17 @@ requests; subscriptions receive only future publications and never replay a
|
|
|
51
51
|
retained value.
|
|
52
52
|
|
|
53
53
|
Permission decisions belong to the current Program, not to the desktop System.
|
|
54
|
-
They are available from a Program handle and flattened through `
|
|
54
|
+
They are available from a Program handle and flattened through `context` as the
|
|
55
55
|
same canonical capability:
|
|
56
56
|
|
|
57
57
|
```ts
|
|
58
|
-
const program = await
|
|
58
|
+
const program = await context.program()
|
|
59
59
|
|
|
60
60
|
await program.permission.granted("pointer")
|
|
61
|
-
await
|
|
62
|
-
await
|
|
61
|
+
await context.permission.request("pointer")
|
|
62
|
+
await context.permission.timeout(5_000).request("pointer")
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
context.permission === program.permission
|
|
65
65
|
```
|
|
66
66
|
|
|
67
67
|
`granted()` reads the effective decision without prompting. `request()` asks
|
|
@@ -98,13 +98,13 @@ into the endpoint. Identity, Theme, Process, Window, readiness, lifecycle, and
|
|
|
98
98
|
application values enter only in response to an explicit request or a live
|
|
99
99
|
registration made by Program code.
|
|
100
100
|
|
|
101
|
-
`
|
|
101
|
+
`Context` combines navigation into the executing Client's Process with its
|
|
102
102
|
Channel. The paired Server is explicitly named as
|
|
103
|
-
`
|
|
104
|
-
operations never masquerade as properties of `
|
|
103
|
+
`context.server`; its publishing, asking, existence, readiness, start, and stop
|
|
104
|
+
operations never masquerade as properties of `context`. `context.stop()` stops
|
|
105
105
|
the executing Client, while complete Process exit remains available only
|
|
106
|
-
through `
|
|
107
|
-
`
|
|
106
|
+
through `context.process()`. It is the canonical Process-owned handle, so
|
|
107
|
+
`context.server === (await context.process()).server`.
|
|
108
108
|
Endpoint `process()` navigation is asynchronous; contextual ownership is
|
|
109
109
|
requested only when navigation needs it and then retained by the SDK.
|
|
110
110
|
|
|
@@ -121,7 +121,7 @@ absence or incarnation loss rejects without turning the boundary into a waiter.
|
|
|
121
121
|
The package provides two contextual runtime entry points:
|
|
122
122
|
|
|
123
123
|
```ts
|
|
124
|
-
import { system,
|
|
124
|
+
import { system, context } from "@phreshos/client"
|
|
125
125
|
```
|
|
126
126
|
|
|
127
127
|
It also re-exports the shared Core runtime classes—`Program`, `Process`,
|
|
@@ -131,11 +131,11 @@ them. These are the same domain classes used by the Server SDK, so
|
|
|
131
131
|
`ClientTraffic`, is a type-only capability owned by Client and has no
|
|
132
132
|
independent `instanceof` identity.
|
|
133
133
|
|
|
134
|
-
The
|
|
134
|
+
The executing Client's Channel is composed directly into `context`. Its
|
|
135
135
|
subscription tools receive events addressed to this Client, while `publish()`
|
|
136
136
|
emits outward from this Client without choosing a destination. Existence,
|
|
137
|
-
readiness, and lifecycle operations belong to `
|
|
138
|
-
`
|
|
137
|
+
readiness, and lifecycle operations belong to `context.server`,
|
|
138
|
+
`context.stop()`, or an explicit Endpoint handle.
|
|
139
139
|
|
|
140
140
|
An Endpoint handle is also a selective source: `endpoint.subscribe()` follows
|
|
141
141
|
destinationless events emitted by that Endpoint. Its `traffic` property remains
|
|
@@ -151,7 +151,7 @@ They deliberately omit `install()` and `fork()`, and their `Storage` values neve
|
|
|
151
151
|
expose native filesystem paths. Every Client-side Window handle exposes the same
|
|
152
152
|
authoritative, subscribable Window capability and its `window.local` physical
|
|
153
153
|
representation on this desktop. Local reads and updates have no events and do
|
|
154
|
-
not change Server state. `
|
|
154
|
+
not change Server state. `context.window` is only convenient access to the
|
|
155
155
|
executing Client's canonical Window; it has no additional authority.
|
|
156
156
|
|
|
157
157
|
A Client may uninstall only its own Program. The operation is an async
|
|
@@ -186,9 +186,9 @@ two independent operations and can expose an intermediate state remotely.
|
|
|
186
186
|
An `under` or `over` representation may request one local system-rendered Surface:
|
|
187
187
|
|
|
188
188
|
```ts
|
|
189
|
-
await
|
|
189
|
+
await context.window.local.surface.set({ duration: 240, easing: "ease-out", wait: true })
|
|
190
190
|
|
|
191
|
-
await
|
|
191
|
+
await context.window.local.surface.remove({ duration: 180, easing: "ease-in" })
|
|
192
192
|
```
|
|
193
193
|
|
|
194
194
|
The desktop holds local state only for the lifetime of that iframe
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { type Channel } from "./channel.js";
|
|
2
2
|
import { Client, Server, type Process, type Program, type Window } from "./domain.js";
|
|
3
|
-
/** The
|
|
4
|
-
export type
|
|
5
|
-
/**
|
|
6
|
-
export interface
|
|
7
|
-
/** The same Server handle exposed by the
|
|
8
|
-
readonly server:
|
|
9
|
-
/** Presentation capability of
|
|
3
|
+
/** The executing Process's canonical Server handle. */
|
|
4
|
+
export type ContextServer<Events extends object = {}> = Server<Events>;
|
|
5
|
+
/** Client runtime context: its inbound Channel, owner hierarchy, and paired Server. */
|
|
6
|
+
export interface Context<Events extends object = {}> extends Channel<Events>, Pick<Client, "service"> {
|
|
7
|
+
/** The same Server handle exposed by the executing Process. */
|
|
8
|
+
readonly server: ContextServer;
|
|
9
|
+
/** Presentation capability of the executing Client. */
|
|
10
10
|
readonly window: Window;
|
|
11
|
-
/** The same permission capability exposed by the
|
|
11
|
+
/** The same permission capability exposed by the executing Program. */
|
|
12
12
|
readonly permission: Program["permission"];
|
|
13
13
|
/** Returns the Process represented by this Client. */
|
|
14
14
|
process(): Promise<Process>;
|
|
@@ -18,8 +18,8 @@ export interface Current<Events extends object = {}> extends Channel<Events>, Pi
|
|
|
18
18
|
program(): Promise<Program>;
|
|
19
19
|
/** Returns one immutable option supplied when this Process was created. */
|
|
20
20
|
option(name: string): Promise<string | undefined>;
|
|
21
|
-
/** Stops the
|
|
21
|
+
/** Stops the executing Client; rejects when it is the final live Endpoint. */
|
|
22
22
|
stop(): Promise<void>;
|
|
23
23
|
}
|
|
24
|
-
/** Inbound events, owner hierarchy, and paired Server for
|
|
25
|
-
export declare const
|
|
24
|
+
/** Inbound events, owner hierarchy, and paired Server for this Client runtime. */
|
|
25
|
+
export declare const context: Context;
|
|
@@ -6,7 +6,7 @@ import { endpointService } from "./service.js";
|
|
|
6
6
|
import { currentProgramPermission } from "./permissions.js";
|
|
7
7
|
const ServerBase = Server;
|
|
8
8
|
const ClientBase = Client;
|
|
9
|
-
class
|
|
9
|
+
class ContextServerHandle extends ServerBase {
|
|
10
10
|
owner;
|
|
11
11
|
traffic = new ServerTrafficHandle(null, "server");
|
|
12
12
|
constructor(owner) {
|
|
@@ -37,12 +37,12 @@ class CurrentServerHandle extends ServerBase {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
let ownerPromise = null;
|
|
40
|
-
let
|
|
41
|
-
let
|
|
40
|
+
let contextServer;
|
|
41
|
+
let contextClient;
|
|
42
42
|
function owner() {
|
|
43
43
|
if (!ownerPromise) {
|
|
44
44
|
const resolving = wire.request(["current-process"]).then(answer => {
|
|
45
|
-
return process(answer[0], { server:
|
|
45
|
+
return process(answer[0], { server: contextServer, client: contextClient });
|
|
46
46
|
});
|
|
47
47
|
const retained = resolving.catch(error => {
|
|
48
48
|
if (ownerPromise === retained)
|
|
@@ -53,8 +53,8 @@ function owner() {
|
|
|
53
53
|
}
|
|
54
54
|
return ownerPromise;
|
|
55
55
|
}
|
|
56
|
-
|
|
57
|
-
class
|
|
56
|
+
contextServer = new ContextServerHandle(owner);
|
|
57
|
+
class ContextClientHandle extends ClientBase {
|
|
58
58
|
owner;
|
|
59
59
|
traffic = new TrafficHandle(null, "client");
|
|
60
60
|
window = windowHandle(async () => {
|
|
@@ -80,10 +80,10 @@ class CurrentClientHandle extends ClientBase {
|
|
|
80
80
|
async stop() { await wire.request(["stop-endpoint", undefined, "client"]); }
|
|
81
81
|
service() { return endpointService(null, "client"); }
|
|
82
82
|
}
|
|
83
|
-
|
|
84
|
-
class
|
|
85
|
-
server =
|
|
86
|
-
window =
|
|
83
|
+
contextClient = new ContextClientHandle(owner);
|
|
84
|
+
class ClientContext {
|
|
85
|
+
server = contextServer;
|
|
86
|
+
window = contextClient.window;
|
|
87
87
|
permission = currentProgramPermission;
|
|
88
88
|
constructor() {
|
|
89
89
|
bindChannel(this, channel);
|
|
@@ -115,5 +115,5 @@ function bindChannel(target, source) {
|
|
|
115
115
|
disableService: source.disableService.bind(source)
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
|
-
/** Inbound events, owner hierarchy, and paired Server for
|
|
119
|
-
export const
|
|
118
|
+
/** Inbound events, owner hierarchy, and paired Server for this Client runtime. */
|
|
119
|
+
export const context = new ClientContext();
|
package/dist/main.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { system, type System } from "./system.js";
|
|
2
2
|
export { type SystemPointer, type PointerEvents, type PointerPosition } from "./pointer.js";
|
|
3
3
|
export { type DesktopEvents, type DesktopSize, type SystemDesktop } from "./desktop.js";
|
|
4
|
-
export {
|
|
4
|
+
export { context, type Context, type ContextServer } from "./context.js";
|
|
5
5
|
export { type Channel, type ChannelCapture, type ChannelEvents, type ChannelMessage } from "./channel.js";
|
|
6
6
|
export { ClientService, ServerService, Service, type ClientServiceChannel, type ServerServiceChannel, type ServiceChannel, type ServiceKey, type ServiceLifecycleEvents } from "@phreshos/core";
|
|
7
7
|
export { Client, Endpoint, Process, Program, Server, type Window, type ProgramProcess, type AnswerCapture, type AnswerMessage, type AnswerObserver, type AskCapture, type AskMessage, type AskObserver, type ClientTraffic, type EndpointTraffic, type ServerTraffic, type TrafficCapture, type TrafficEvents, type TrafficMessage } from "./domain.js";
|
package/dist/main.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { system } from "./system.js";
|
|
2
2
|
export {} from "./pointer.js";
|
|
3
3
|
export {} from "./desktop.js";
|
|
4
|
-
export {
|
|
4
|
+
export { context } from "./context.js";
|
|
5
5
|
export {} from "./channel.js";
|
|
6
6
|
export { ClientService, ServerService, Service } from "@phreshos/core";
|
|
7
7
|
export { Client, Endpoint, Process, Program, Server } from "./domain.js";
|