@phreshos/client 0.1.23 → 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 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 `current` as the
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 current.program()
58
+ const program = await context.program()
59
59
 
60
60
  await program.permission.granted("pointer")
61
- await current.permission.request("pointer")
62
- await current.permission.timeout(5_000).request("pointer")
61
+ await context.permission.request("pointer")
62
+ await context.permission.timeout(5_000).request("pointer")
63
63
 
64
- current.permission === program.permission
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
- `Current` combines navigation into the executing Client's Process with its
101
+ `Context` combines navigation into the executing Client's Process with its
102
102
  Channel. The paired Server is explicitly named as
103
- `current.server`; its publishing, asking, existence, readiness, start, and stop
104
- operations never masquerade as properties of `current`. `current.stop()` stops
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 `current.process()`. It is the canonical Process-owned handle, so
107
- `current.server === (await current.process()).server`.
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, current } from "@phreshos/client"
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 current Client's Channel is composed directly into `current`. Its
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 `current.server`,
138
- `current.stop()`, or an explicit Endpoint handle.
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. `current.window` is only convenient access to the
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 current.window.local.surface.set({ duration: 240, easing: "ease-out", wait: true })
189
+ await context.window.local.surface.set({ duration: 240, easing: "ease-out", wait: true })
190
190
 
191
- await current.window.local.surface.remove({ duration: 180, easing: "ease-in" })
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 current Process's canonical Server handle. */
4
- export type CurrentServer<Events extends object = {}> = Server<Events>;
5
- /** Current Client context: its inbound Channel, owner hierarchy, and paired Server. */
6
- export interface Current<Events extends object = {}> extends Channel<Events>, Pick<Client, "service"> {
7
- /** The same Server handle exposed by the current Process. */
8
- readonly server: CurrentServer;
9
- /** Presentation capability of this current Client. */
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 current Program. */
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 current Client; rejects when it is the final live Endpoint. */
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 the current Client. */
25
- export declare const current: Current;
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 CurrentServerHandle extends ServerBase {
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 currentServer;
41
- let currentClient;
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: currentServer, client: currentClient });
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
- currentServer = new CurrentServerHandle(owner);
57
- class CurrentClientHandle extends ClientBase {
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
- currentClient = new CurrentClientHandle(owner);
84
- class ClientCurrent {
85
- server = currentServer;
86
- window = currentClient.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 the current Client. */
119
- export const current = new ClientCurrent();
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,8 +1,8 @@
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 { current, type Current, type CurrentServer } from "./current.js";
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
- export { ClientServiceHandler, ServerServiceHandler, ServiceHandler, type ClientServiceChannel, type ServerServiceChannel, type ServiceChannel, type ServiceKey, type ServiceLifecycleEvents } from "@phreshos/core";
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";
8
8
  export type { Askable, Capture, Captures, ClientDeclaration, Cleanup, DirectoryStat, EndpointDeclaration, EntryStat, EventMessage, EventName, EventObserver, EventOptions, EventSubscriber, Exit, FileStat, Launch, LaunchClient, Layer, LogKind, LogRecord, LogSource, Message, OtherStat, Outcome, PermissionDecision, Permission, Position, Storage, ProgramEvents, ProgramProcessEvents, ProgramProcessExit, ProgramSql, ProgramStore, ProcessEvents, Publishable, SystemUploads, Upload, Size, Subscribable, SubscribableEvents, SubscribableFallback, TimedAskable, TimedPermission, Timeoutable, Appearance, AppearanceEvents, AppearanceSource, AppearanceSurface, AnimationsPreference, DesktopPreferences, DesktopPreferencesEvents, DesktopPreferencesUpdate, SystemDesktopPreferences, ThemedValue, Theme, ThemePreference, Value, WindowEvents, WindowGeometry, WindowLayer, WindowState, Easing, LocalWindow, LocalWindowSurface, VisibilityTransition, Transaction } from "@phreshos/core";
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 { current } from "./current.js";
4
+ export { context } from "./context.js";
5
5
  export {} from "./channel.js";
6
- export { ClientServiceHandler, ServerServiceHandler, ServiceHandler } from "@phreshos/core";
6
+ export { ClientService, ServerService, Service } from "@phreshos/core";
7
7
  export { Client, Endpoint, Process, Program, Server } from "./domain.js";
package/dist/service.d.ts CHANGED
@@ -1,14 +1,14 @@
1
- import { type ClientServiceHandler, type ServerServiceHandler, type ServiceHandler, type ServiceKey } from "@phreshos/core";
1
+ import { type ClientService, type ServerService, type Service, type ServiceKey } from "@phreshos/core";
2
2
  import type { HandleAddress } from "./domain.js";
3
3
  export declare function prepareService<EventsMap extends object = {}>(key: ServiceKey & {
4
4
  endpoint: "server";
5
- }): ServerServiceHandler<EventsMap>;
5
+ }): ServerService<EventsMap>;
6
6
  export declare function prepareService<EventsMap extends object = {}>(key: ServiceKey & {
7
7
  endpoint: "client";
8
- }): ClientServiceHandler<EventsMap>;
9
- export declare function prepareService(key: ServiceKey): ServiceHandler;
8
+ }): ClientService<EventsMap>;
9
+ export declare function prepareService(key: ServiceKey): Service;
10
10
  export declare function enableCurrentService(name: string): Promise<void>;
11
11
  export declare function disableCurrentService(): Promise<void>;
12
- export declare function endpointService<EventsMap extends object = {}>(target: HandleAddress | null, endpoint: "server"): Promise<ServerServiceHandler<EventsMap> | null>;
13
- export declare function endpointService<EventsMap extends object = {}>(target: HandleAddress | null, endpoint: "client"): Promise<ClientServiceHandler<EventsMap> | null>;
14
- export declare function endpointService(target: HandleAddress | null, endpoint: "server" | "client"): Promise<ServiceHandler | null>;
12
+ export declare function endpointService<EventsMap extends object = {}>(target: HandleAddress | null, endpoint: "server"): Promise<ServerService<EventsMap> | null>;
13
+ export declare function endpointService<EventsMap extends object = {}>(target: HandleAddress | null, endpoint: "client"): Promise<ClientService<EventsMap> | null>;
14
+ export declare function endpointService(target: HandleAddress | null, endpoint: "server" | "client"): Promise<Service | null>;
package/dist/service.js CHANGED
@@ -1,11 +1,11 @@
1
- import { ClientServiceHandler as CoreClientServiceHandler, ServerServiceHandler as CoreServerServiceHandler, isServiceKey } from "@phreshos/core";
1
+ import { ClientService as CoreClientService, ServerService as CoreServerService, isServiceKey } from "@phreshos/core";
2
2
  import Deadline from "./deadline.js";
3
3
  import Events from "./events.js";
4
4
  import HandleRegistry from "./handle-registry.js";
5
5
  import wire from "./wire.js";
6
6
  const handles = new HandleRegistry();
7
- const ServerServiceBase = CoreServerServiceHandler;
8
- const ClientServiceBase = CoreClientServiceHandler;
7
+ const ServerServiceBase = CoreServerService;
8
+ const ClientServiceBase = CoreClientService;
9
9
  class ServerChannelHandle extends Events {
10
10
  key;
11
11
  constructor(key) {
package/dist/system.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import type { AppearanceSource, ClientServiceHandler, SystemDesktopPreferences, ServerServiceHandler, ServiceKey, SystemUploads } from "@phreshos/core";
1
+ import type { AppearanceSource, ClientService, SystemDesktopPreferences, ServerService, ServiceKey, SystemUploads } from "@phreshos/core";
2
2
  import { type SystemPointer } from "./pointer.js";
3
3
  import { type SystemDesktop } from "./desktop.js";
4
4
  type ServiceEndpoint = ServiceKey["endpoint"];
5
5
  type ServiceAddress<Endpoint extends ServiceEndpoint> = Omit<ServiceKey, "endpoint"> & Readonly<{
6
6
  endpoint: Endpoint;
7
7
  }>;
8
- type ServiceHandle<Endpoint extends ServiceEndpoint, Events extends object> = Endpoint extends "server" ? ServerServiceHandler<Events> : ClientServiceHandler<Events>;
8
+ type ServiceHandle<Endpoint extends ServiceEndpoint, Events extends object> = Endpoint extends "server" ? ServerService<Events> : ClientService<Events>;
9
9
  /** Desktop capabilities structurally available to a Client endpoint. */
10
10
  export interface System {
11
11
  /** Complete unresolved Appearance read from the System authority. */
@@ -23,9 +23,9 @@ export interface System {
23
23
  /** Returns a precisely typed stable handle for either service endpoint. */
24
24
  service<Endpoint extends ServiceEndpoint>(key: ServiceAddress<Endpoint>): ServiceHandle<Endpoint, {}>;
25
25
  /** Returns a typed stable handle for one exact Server service identity. */
26
- service<ServiceEvents extends object>(key: ServiceAddress<"server">): ServerServiceHandler<ServiceEvents>;
26
+ service<ServiceEvents extends object>(key: ServiceAddress<"server">): ServerService<ServiceEvents>;
27
27
  /** Returns a typed stable handle for one exact Client service identity. */
28
- service<ServiceEvents extends object>(key: ServiceAddress<"client">): ClientServiceHandler<ServiceEvents>;
28
+ service<ServiceEvents extends object>(key: ServiceAddress<"client">): ClientService<ServiceEvents>;
29
29
  }
30
30
  /** Desktop capabilities available to this Client. */
31
31
  export declare const system: System;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phreshos/client",
3
- "version": "0.1.23",
3
+ "version": "0.1.25",
4
4
  "description": "The SDK used by a Program's client endpoint.",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",
@@ -47,13 +47,13 @@
47
47
  "prepack": "node --run build"
48
48
  },
49
49
  "peerDependencies": {
50
- "@phreshos/core": "^0.1.22"
50
+ "@phreshos/core": "^0.1.24"
51
51
  },
52
52
  "dependencies": {
53
53
  "@msgpack/msgpack": "^3.1.3"
54
54
  },
55
55
  "devDependencies": {
56
- "@phreshos/core": "^0.1.22",
56
+ "@phreshos/core": "^0.1.24",
57
57
  "typescript": "^6.0.3"
58
58
  }
59
59
  }