@phreshos/core 0.1.3 → 0.1.5

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
@@ -234,22 +234,17 @@ Program and the deliberately narrow `WallpaperLaunch`, containing only `name`,
234
234
  These contracts describe capability and data shape only — they contain no
235
235
  persistence, upload, Process creation, or rendering implementation.
236
236
 
237
- ## Window Surface
238
-
239
- `client.window.surface` addresses the optional host-rendered material belonging
240
- to one Window. Its source of truth is authoritative, server-owned Window state,
241
- not iframe state. Program endpoints may explicitly replace or remove that
242
- target, but cannot read or subscribe to it. A `null` target means no Surface
243
- exists in the render tree.
244
-
245
- Only Windows currently occupying the `under` or `over` layer may call `set()`
246
- or `remove()`; `window` and `wallpaper` layers reject those operations. Calling
247
- `set()` without settings creates a sharp, fully opaque Surface. Settings may
248
- select opacity from zero to one, a nonnegative pixel radius, a scale level, or
249
- `"full"`, and an optional transaction containing a duration from zero through
250
- 60,000 milliseconds and a stable named or cubic Bézier easing. Zero opacity
251
- retains the Surface node; only `remove()` returns the authoritative target
252
- immediately to `null`. The server validates settings, and the desktop animates
237
+ ## Client Surface values
238
+
239
+ `ClientSurfaceSettings` describes optional host-rendered material requested by
240
+ one live Client representation. It is a value contract, not Window state and
241
+ not server authority. Calling the Client capability without settings creates a
242
+ sharp, fully opaque Surface. Settings may select opacity from zero to one, a
243
+ nonnegative pixel radius, a scale level, or `"full"`, and an optional
244
+ transaction containing a duration from zero through 60,000 milliseconds and a
245
+ stable named or cubic Bézier easing. Zero opacity
246
+ retains the Surface node; the Client capability's separate `remove()` command
247
+ removes it immediately. The receiving desktop validates settings and animates
253
248
  from the rendered values to each new target.
254
249
 
255
250
  ## Window geometry
@@ -261,6 +256,15 @@ pixel number or a linear relative expression such as `"1/2"`, `"50% + 10"`, or
261
256
  offset. The CLI, runtime validation, and desktop layout all consume this one
262
257
  Core definition rather than maintaining separate parsers.
263
258
 
259
+ `move()` and `resize()` change one dimension of authoritative geometry.
260
+ `setGeometry({ position, size })` validates and commits both dimensions as one
261
+ operation, then emits one `geometry` event. Compound interactions such as
262
+ resizing from a top or left edge and snapping must use this atomic form so a
263
+ remote representation never observes a new position with the previous size.
264
+ `move` and `resize` subscribers are also notified after the complete geometry
265
+ has committed; those component notifications never represent partial
266
+ authoritative state.
267
+
264
268
  ## Process parentage
265
269
 
266
270
  Process parentage belongs to `Process`, not to contextual SDK state. Each
package/dist/channel.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { Endpoint } from "./endpoint.js";
2
2
  import type { Publishable } from "./publishable.js";
3
+ import type { ServiceDefinition } from "./service.js";
3
4
  import type { Captures, Subscribable } from "./subscribable.js";
4
5
  /** One application value arriving through the current Endpoint's Channel. */
5
6
  export type ChannelMessage<Payload = unknown, From = Endpoint> = Readonly<{
@@ -16,9 +17,9 @@ type ChannelFallback<Events extends object, From> = keyof Events extends never ?
16
17
  /** Every application event observable through a Channel. */
17
18
  export type ChannelCapture<Events extends object = {}, From = Endpoint> = Captures<ChannelEvents<Events, From>, ChannelFallback<Events, From>>;
18
19
  /** Addressed input and destinationless output for the executing Endpoint. */
19
- export interface Channel<Events extends object = {}, From = Endpoint> extends Subscribable<ChannelEvents<Events, From>, ChannelFallback<Events, From>>, Publishable {
20
+ export interface Channel<Events extends object = {}, From = Endpoint, Definition extends ServiceDefinition = ServiceDefinition> extends Subscribable<ChannelEvents<Events, From>, ChannelFallback<Events, From>>, Publishable {
20
21
  /** Exposes this executing Channel under one public service name. */
21
- enableService(name: string): Promise<void>;
22
+ enableService(definition: Definition): Promise<void>;
22
23
  /** Stops exposing this executing Channel as a service. */
23
24
  disableService(): Promise<void>;
24
25
  }
@@ -0,0 +1,19 @@
1
+ import type { ScaleLevel } from "./scale.js";
2
+ /** Stable easing accepted by one Client representation's Surface transaction. */
3
+ export type ClientSurfaceEasing = "linear" | "ease" | "ease-in" | "ease-out" | "ease-in-out" | readonly [number, number, number, number];
4
+ /** Motion applied locally when one Client representation replaces its Surface target. */
5
+ export type ClientSurfaceTransaction = Readonly<{
6
+ /** Duration in milliseconds. Omission uses the desktop duration. */
7
+ duration?: number;
8
+ /** Timing curve. Omission uses the desktop curve. */
9
+ easing?: ClientSurfaceEasing;
10
+ }>;
11
+ /** Local host Surface requested by one live Client representation. */
12
+ export type ClientSurfaceSettings = Readonly<{
13
+ /** Whole-Surface opacity from zero through one. Omission means one. */
14
+ opacity?: number;
15
+ /** A Theme-derived level, CSS pixels, or maximum proportional rounding. Omission means zero. */
16
+ radius?: ScaleLevel | number | "full";
17
+ /** Optional motion from the currently rendered values to this target. */
18
+ transaction?: ClientSurfaceTransaction;
19
+ }>;
File without changes
package/dist/config.d.ts CHANGED
@@ -52,11 +52,6 @@ type Description = Readonly<{
52
52
  version?: string;
53
53
  /** Short human-readable explanation of what the Program does. */
54
54
  description?: string;
55
- /**
56
- * Markdown file describing only the Program-owned API contract.
57
- * System access, Endpoint, and event mechanics belong to system documentation.
58
- */
59
- apiDocs?: string;
60
55
  /** PNG source between 128 and 2,048 pixels per side and no larger than 5 MiB. */
61
56
  icon?: string;
62
57
  /** Command run before production start, installation, and packaging. */
package/dist/main.d.ts CHANGED
@@ -2,7 +2,7 @@ export { type Message, type Cleanup, type Capture, type Captures, type EventMess
2
2
  export { type Publishable } from "./publishable.js";
3
3
  export { type Timeoutable } from "./timeout.js";
4
4
  export { type Askable, type TimedAskable } from "./askable.js";
5
- export { ClientServiceHandler, ServerServiceHandler, ServiceHandler, isServiceKey, type ClientServiceChannel, type ServerServiceChannel, type ServiceChannel, type ServiceKey, type ServiceLifecycleEvents } from "./service.js";
5
+ export { ClientServiceHandler, ServerServiceHandler, ServiceHandler, isServiceKey, type ClientServiceChannel, type ServerServiceChannel, type ServerServiceDefinition, type ServiceChannel, type ServiceDefinition, type ServiceKey, type ServiceLifecycleEvents } from "./service.js";
6
6
  export { isPermissionName, permissionNames, type PermissionDecision, type PermissionDecisions, type PermissionName, type Permissions, type ProgramPermissions, type TimedPermissions } from "./permissions.js";
7
7
  export { type Outcome } from "./outcome.js";
8
8
  export { type ServedFile } from "./served-file.js";
@@ -19,6 +19,7 @@ export { Server, type AnswerCapture, type AnswerMessage, type AnswerObserver, ty
19
19
  export { Client, type ClientTraffic } from "./client.js";
20
20
  export { Process, type Exit, type ProcessEvents } from "./process.js";
21
21
  export { Program, type ClientDeclaration, type EndpointDeclaration, type ProgramEvents, type ProgramIconSize, type ProgramProcessExit } from "./program.js";
22
- export { type Window, type WindowEvents, type WindowLayer, type WindowState, type WindowSurface, type WindowSurfaceEasing, type WindowSurfaceSettings, type WindowSurfaceTransaction } from "./window.js";
22
+ export { type Window, type WindowEvents, type WindowGeometry, type WindowLayer, type WindowState } from "./window.js";
23
+ export { type ClientSurfaceEasing, type ClientSurfaceSettings, type ClientSurfaceTransaction } from "./client-surface.js";
23
24
  export { layers, type Launch, type LaunchClient, type Layer, type Position, type Size } from "./launch.js";
24
25
  export { defineConfig, type ClientConfig, type ClientDevelopment, type Config, type ServerConfig, type ServerDevelopment } from "./config.js";
package/dist/main.js CHANGED
@@ -20,5 +20,6 @@ export { Client } from "./client.js";
20
20
  export { Process } from "./process.js";
21
21
  export { Program } from "./program.js";
22
22
  export {} from "./window.js";
23
+ export {} from "./client-surface.js";
23
24
  export { layers } from "./launch.js";
24
25
  export { defineConfig } from "./config.js";
@@ -14,7 +14,7 @@ export interface TimedPermissions {
14
14
  /** Requests one permission, resolving `null` if the deadline expires. */
15
15
  request(name: PermissionName): Promise<PermissionDecision>;
16
16
  }
17
- /** Client access to the current Process's permissions. */
17
+ /** Client access to one Program's effective permission decisions. */
18
18
  export interface Permissions extends Timeoutable<TimedPermissions> {
19
19
  /** Reads the effective decision without prompting the user. */
20
20
  granted(name: PermissionName): Promise<PermissionDecision>;
package/dist/program.d.ts CHANGED
@@ -83,11 +83,6 @@ export interface Program<Events extends object = {}> extends Subscribable<Progra
83
83
  getProcess(identityOrName: string): Promise<Process | null>;
84
84
  /** Creates one Process of this Program. */
85
85
  createProcess(launch?: Launch): Promise<Process>;
86
- /**
87
- * Returns the Program-authored API entry point, or `null`.
88
- * The document describes the Program's contract, not system mechanics.
89
- */
90
- apiDocs(): Promise<string | null>;
91
86
  /**
92
87
  * Returns one standard PNG representation of this Program's icon.
93
88
  * Programs without an authored icon receive the system default.
package/dist/service.d.ts CHANGED
@@ -9,6 +9,16 @@ export type ServiceKey = Readonly<{
9
9
  /** Program-authored service identity. */
10
10
  name: string;
11
11
  }>;
12
+ /** Runtime declaration of one service exposed by an Endpoint Channel. */
13
+ export type ServiceDefinition = Readonly<{
14
+ /** Program-authored service identity. */
15
+ name: string;
16
+ }>;
17
+ /** Runtime declaration of one Server service and its optional API document. */
18
+ export type ServerServiceDefinition = ServiceDefinition & Readonly<{
19
+ /** Complete API documentation owned by this service. */
20
+ docs?: string;
21
+ }>;
12
22
  /** Lifecycle transitions of one exact service identity. */
13
23
  export type ServiceLifecycleEvents = {
14
24
  /** A live Endpoint began providing this service. */
@@ -48,6 +58,8 @@ export declare class ServerServiceHandler<Events extends object = {}> extends Se
48
58
  export interface ServerServiceHandler<Events extends object = {}> {
49
59
  readonly endpoint: "server";
50
60
  readonly channel: ServerServiceChannel<Events>;
61
+ /** Explicitly reads this live Server service's documentation, or `null`. */
62
+ docs(): Promise<string | null>;
51
63
  }
52
64
  /** Stable handle for one Client-provided service. */
53
65
  export declare class ClientServiceHandler<Events extends object = {}> extends ServiceHandler<ClientServiceChannel<Events>> {
package/dist/window.d.ts CHANGED
@@ -1,39 +1,22 @@
1
1
  import type { Layer, Position, Size } from "./launch.js";
2
- import type { ScaleLevel } from "./scale.js";
3
2
  import type { Subscribable } from "./subscribable.js";
4
3
  /** The authoritative runtime layer occupied by a Window. */
5
4
  export type WindowLayer = Layer | "wallpaper";
6
- /** Stable easing accepted by a Window Surface transaction. */
7
- export type WindowSurfaceEasing = "linear" | "ease" | "ease-in" | "ease-out" | "ease-in-out" | readonly [number, number, number, number];
8
- /** Motion applied by a desktop when one authoritative Surface target replaces another. */
9
- export type WindowSurfaceTransaction = Readonly<{
10
- /** Duration in milliseconds. Omission uses the system duration. */
11
- duration?: number;
12
- /** Timing curve. Omission uses the system curve. */
13
- easing?: WindowSurfaceEasing;
14
- }>;
15
- /** Authoritative target settings for one Window's optional host Surface. */
16
- export type WindowSurfaceSettings = Readonly<{
17
- /** Whole-Surface opacity from zero through one. Omission means one. */
18
- opacity?: number;
19
- /** A Theme-derived level, CSS pixels, or maximum proportional rounding. Omission means zero. */
20
- radius?: ScaleLevel | number | "full";
21
- /** Optional motion from the currently rendered values to this target. */
22
- transaction?: WindowSurfaceTransaction;
5
+ /** Position and size committed as one authoritative Window change. */
6
+ export type WindowGeometry = Readonly<{
7
+ /** Complete top-left position. */
8
+ position: Position;
9
+ /** Complete width and height. */
10
+ size: Size;
23
11
  }>;
24
- /** Optional host-rendered material owned by one authoritative Window. */
25
- export interface WindowSurface {
26
- /** Creates or replaces the authoritative target. Omission creates the default Surface. */
27
- set(settings?: WindowSurfaceSettings): Promise<void>;
28
- /** Immediately removes the authoritative Surface. */
29
- remove(): Promise<void>;
30
- }
31
12
  /** Events emitted when authoritative Window state changes. */
32
13
  export type WindowEvents = {
33
14
  /** The authoritative top-left position changed. */
34
15
  move: Position;
35
16
  /** The authoritative width or height changed. */
36
17
  resize: Size;
18
+ /** Position and size changed in one atomic operation. */
19
+ geometry: WindowGeometry;
37
20
  /** The authoritative minimized state changed. */
38
21
  minimize: boolean;
39
22
  /** The authoritative title changed. */
@@ -60,8 +43,6 @@ export type WindowState = Readonly<{
60
43
  }>;
61
44
  /** Presentation capability owned by one Client handle. */
62
45
  export interface Window extends Subscribable<WindowEvents, never> {
63
- /** Authoritative host-rendered material associated with this Window. */
64
- readonly surface: WindowSurface;
65
46
  /** Returns the current title. */
66
47
  title(): Promise<string>;
67
48
  /** Returns the current top-left position. */
@@ -80,6 +61,8 @@ export interface Window extends Subscribable<WindowEvents, never> {
80
61
  move(position: Position): Promise<void>;
81
62
  /** Resizes the authoritative Window. */
82
63
  resize(size: Size): Promise<void>;
64
+ /** Changes position and size as one authoritative operation. */
65
+ setGeometry(geometry: WindowGeometry): Promise<void>;
83
66
  /** Changes whether the Window is minimized. */
84
67
  minimize(minimized?: boolean): Promise<void>;
85
68
  /** Changes the Window title. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phreshos/core",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Environment-neutral contracts and domain objects for PhreshOS Programs.",
5
5
  "type": "module",
6
6
  "sideEffects": false,