@phreshos/core 0.1.8 → 0.1.9

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
@@ -74,7 +74,11 @@ and material opacity; its standard backdrop is zero, so blur is opt-in.
74
74
  `createThemeSnapshot()` copies and freezes one complete value at the contract
75
75
  boundary. An implementing authority remains responsible for validation,
76
76
  persistence, and the current value; its own schema may derive its defaults from
77
- `standardTheme` rather than duplicating them.
77
+ `standardTheme` rather than duplicating them. Its standard background is
78
+ `#fffff5`; both grain intensity and grain amount default to zero. Surface also
79
+ stores animation, material opacity, optional backdrop blur and three
80
+ displacement stages, plus neutral saturation and brightness. Effects whose
81
+ neutral value avoids rendering work remain neutral by default.
78
82
 
79
83
  Derived variants are calculations, not persisted `Theme` state. `numericScale()`
80
84
  produces `xsmall`, `small`, `medium`, `large`, and `xlarge`, preserving the
package/dist/main.d.ts CHANGED
@@ -2,8 +2,8 @@ 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 ServerServiceDefinition, type ServiceChannel, type ServiceDefinition, type ServiceKey, type ServiceLifecycleEvents } from "./service.js";
6
- export { isPermissionName, permissionNames, type PermissionDecision, type PermissionDecisions, type PermissionName, type Permissions, type ProgramPermissions, type TimedPermissions } from "./permissions.js";
5
+ export { ClientServiceHandler, ServerServiceHandler, ServiceHandler, isServiceKey, type ClientServiceChannel, type ServerServiceChannel, type ServerServiceDefinition, type ServiceChannel, type ServiceDefinition, type ServiceKey, type ServiceLifecycleEvents, type ServiceRegistryEvents } from "./service.js";
6
+ export { isPermissionName, permissionNames, type PermissionDecision, type PermissionDecisions, type PermissionName, type Permission, type ProgramPermission, type TimedPermission } from "./permissions.js";
7
7
  export { type Outcome } from "./outcome.js";
8
8
  export { type ServedFile } from "./served-file.js";
9
9
  export { type DesktopWallpaper, type FileWallpaper, type WallpaperLaunch } from "./wallpaper.js";
@@ -18,7 +18,7 @@ export { type Channel, type ChannelCapture, type ChannelEvents, type ChannelMess
18
18
  export { Server, type AnswerCapture, type AnswerMessage, type AnswerObserver, type ServerTraffic } from "./server.js";
19
19
  export { Client, type ClientTraffic } from "./client.js";
20
20
  export { Process, type Exit, type ProcessEvents } from "./process.js";
21
- export { Program, type ClientDeclaration, type EndpointDeclaration, type ProgramEvents, type ProgramIconSize, type ProgramProcessExit } from "./program.js";
21
+ export { Program, type ClientDeclaration, type EndpointDeclaration, type ProgramEvents, type ProgramIconSize, type ProgramProcess, type ProgramProcessEvents, type ProgramProcessExit } from "./program.js";
22
22
  export { type Window, type WindowEvents, type WindowGeometry, type WindowLayer, type WindowState } from "./window.js";
23
23
  export { type LocalWindow, type LocalWindowSurface, type SurfaceSettings } from "./local-window.js";
24
24
  export { type Easing, type Transaction } from "./transaction.js";
@@ -10,19 +10,19 @@ export declare function isPermissionName(value: unknown): value is PermissionNam
10
10
  /** The effective decision for one permission, or `null` when none is known. */
11
11
  export type PermissionDecision = boolean | null;
12
12
  /** Permission requests using one caller-selected deadline. */
13
- export interface TimedPermissions {
13
+ export interface TimedPermission {
14
14
  /** Requests one permission, resolving `null` if the deadline expires. */
15
15
  request(name: PermissionName): Promise<PermissionDecision>;
16
16
  }
17
17
  /** Client access to one Program's effective permission decisions. */
18
- export interface Permissions extends Timeoutable<TimedPermissions> {
18
+ export interface Permission extends Timeoutable<TimedPermission> {
19
19
  /** Reads the effective decision without prompting the user. */
20
20
  granted(name: PermissionName): Promise<PermissionDecision>;
21
21
  /** Requests a decision from the user. The default deadline is 30 seconds. */
22
22
  request(name: PermissionName): Promise<PermissionDecision>;
23
23
  }
24
24
  /** Server-side management of one Program's persistent permission decisions. */
25
- export interface ProgramPermissions {
25
+ export interface ProgramPermission {
26
26
  /** Reads one persistent decision, or `undefined` when none is stored. */
27
27
  get(name: PermissionName): Promise<boolean | undefined>;
28
28
  /** Returns an independent snapshot of every persistent decision. */
package/dist/process.d.ts CHANGED
@@ -38,7 +38,7 @@ export interface Process<Events extends object = {}> extends Subscribable<Proces
38
38
  /** Returns the Program that owns this Process. */
39
39
  program(): Program;
40
40
  /**
41
- * Returns the Process whose `createProcess()` call created this Process.
41
+ * Returns the Process whose `program.process.create()` call created this Process.
42
42
  *
43
43
  * Returns `null` when this Process has no accessible parent handle. Rejects
44
44
  * when this Process or its retained parent no longer exists. Client
package/dist/program.d.ts CHANGED
@@ -28,16 +28,34 @@ export type ProgramProcessExit = Exit & Readonly<{
28
28
  /** Process that ended. */
29
29
  process: Process;
30
30
  }>;
31
- /** Lifecycle events scoped to one Program. */
32
- export type ProgramEvents = {
31
+ /** Process lifecycle events scoped to one Program. */
32
+ export type ProgramProcessEvents = {
33
33
  /** One Process Endpoint entered a new live incarnation. */
34
34
  endpointStart: Process["server"] | Process["client"];
35
35
  /** One Process Endpoint incarnation ended. */
36
36
  endpointStop: Process["server"] | Process["client"];
37
37
  /** A Process entered this Program's runtime set. */
38
- processCreate: Process;
38
+ create: Process;
39
39
  /** A Process left this Program's runtime set. */
40
- processExit: ProgramProcessExit;
40
+ exit: ProgramProcessExit;
41
+ };
42
+ /** Operations over the Processes belonging to one Program. */
43
+ export interface ProgramProcess extends Subscribable<ProgramProcessEvents, never> {
44
+ /** Returns every live Process of this Program available to this SDK. */
45
+ list(): Promise<Process[]>;
46
+ /** Returns the earliest-started live Process, or `null` when none exist. */
47
+ first(): Promise<Process | null>;
48
+ /** Returns the latest-started live Process, or `null` when none exist. */
49
+ last(): Promise<Process | null>;
50
+ /** Finds a live Process by identity or Program-local name. */
51
+ find(identityOrName: string): Promise<Process | null>;
52
+ /** Creates one Process of this Program. */
53
+ create(launch?: Launch): Promise<Process>;
54
+ /** Ends every live Process and returns their identities. */
55
+ exitAll(): Promise<string[]>;
56
+ }
57
+ /** Lifecycle events belonging to one Program entity. */
58
+ export type ProgramEvents = {
41
59
  /** This Program left the runtime registry. */
42
60
  forget: undefined;
43
61
  /** This Program left the installed state. */
@@ -73,16 +91,8 @@ export interface Program<Events extends object = {}> extends Subscribable<Progra
73
91
  readonly logs: ProgramSql;
74
92
  /** Writable SQLite database owned by this Program. */
75
93
  readonly database: ProgramSql;
76
- /** Returns every live Process of this Program available to this SDK. */
77
- processes(): Promise<Process[]>;
78
- /** Returns the earliest-started live Process, or `null` when none exist. */
79
- firstProcess(): Promise<Process | null>;
80
- /** Returns the latest-started live Process, or `null` when none exist. */
81
- lastProcess(): Promise<Process | null>;
82
- /** Finds a live Process by identity or Program-local name. */
83
- getProcess(identityOrName: string): Promise<Process | null>;
84
- /** Creates one Process of this Program. */
85
- createProcess(launch?: Launch): Promise<Process>;
94
+ /** Operations and lifecycle observation for this Program's Processes. */
95
+ readonly process: ProgramProcess;
86
96
  /**
87
97
  * Returns one standard PNG representation of this Program's icon.
88
98
  * Programs without an authored icon receive the system default.
@@ -96,6 +106,4 @@ export interface Program<Events extends object = {}> extends Subscribable<Progra
96
106
  uninstall(everything?: boolean): Promise<void>;
97
107
  /** Ends all Processes and removes this Program from the runtime registry. */
98
108
  forget(): Promise<void>;
99
- /** Ends every live Process and returns their identities. */
100
- exitAll(): Promise<string[]>;
101
109
  }
package/dist/service.d.ts CHANGED
@@ -26,6 +26,13 @@ export type ServiceLifecycleEvents = {
26
26
  /** The providing Endpoint stopped exposing this service. */
27
27
  disable: undefined;
28
28
  };
29
+ /** Lifecycle transitions across the authoritative service registry. */
30
+ export type ServiceRegistryEvents = {
31
+ /** A service entered the enabled registry. */
32
+ enable: ServiceKey;
33
+ /** A service left the enabled registry. */
34
+ disable: ServiceKey;
35
+ };
29
36
  /** Application events emitted by one service. */
30
37
  export interface ServiceChannel<Events extends object = {}> extends Subscribable<Events, keyof Events extends never ? unknown : never> {
31
38
  }
@@ -40,23 +47,20 @@ export declare class ServiceHandler<Channel extends object = ServiceChannel> {
40
47
  protected constructor();
41
48
  }
42
49
  export interface ServiceHandler<Channel extends object = ServiceChannel> extends Subscribable<ServiceLifecycleEvents, never> {
43
- /** Program namespace of this service. */
44
- readonly program: string;
45
- /** Endpoint kind represented by this service. */
46
- readonly endpoint: "server" | "client";
47
50
  /** Program-authored service identity. */
48
51
  readonly name: string;
49
52
  /** Application communication, separate from service lifecycle. */
50
53
  readonly channel: Channel;
51
- /** Explicitly reads whether no live Endpoint currently provides the service. */
52
- disabled(): Promise<boolean>;
54
+ /** Reads whether a live Endpoint currently provides this service. */
55
+ enabled(): Promise<boolean>;
56
+ /** Waits until a live Endpoint provides this service. */
57
+ waitReady(timeout?: number): Promise<void>;
53
58
  }
54
59
  /** Stable handle for one Server-provided service. */
55
60
  export declare class ServerServiceHandler<Events extends object = {}> extends ServiceHandler<ServerServiceChannel<Events>> {
56
61
  protected constructor();
57
62
  }
58
63
  export interface ServerServiceHandler<Events extends object = {}> {
59
- readonly endpoint: "server";
60
64
  readonly channel: ServerServiceChannel<Events>;
61
65
  /** Explicitly reads this live Server service's documentation, or `null`. */
62
66
  docs(): Promise<string | null>;
@@ -66,7 +70,6 @@ export declare class ClientServiceHandler<Events extends object = {}> extends Se
66
70
  protected constructor();
67
71
  }
68
72
  export interface ClientServiceHandler<Events extends object = {}> {
69
- readonly endpoint: "client";
70
73
  readonly channel: ClientServiceChannel<Events>;
71
74
  }
72
75
  /** Returns whether a boundary value is a complete service key. */
package/dist/theme.d.ts CHANGED
@@ -10,12 +10,24 @@ export type ThemeRange = Readonly<{
10
10
  export type ThemeSurface = Readonly<{
11
11
  /** Grain intensity from zero to one. */
12
12
  grain: number;
13
+ /** Fraction of deterministic grain cells retained from zero to one. */
14
+ grainAmount: number;
13
15
  /** Grain texture changes per second. */
14
16
  animation: number;
15
17
  /** Optional backdrop blur in CSS pixels. */
16
18
  backdrop: number;
17
19
  /** Material opacity from zero to one. */
18
20
  opacity: number;
21
+ /** Organic backdrop displacement in CSS pixels. */
22
+ distortion: number;
23
+ /** Directional-wave backdrop displacement in CSS pixels. */
24
+ waves: number;
25
+ /** Ripple backdrop displacement in CSS pixels. */
26
+ ripples: number;
27
+ /** Backdrop saturation multiplier, neutral at one. */
28
+ saturation: number;
29
+ /** Backdrop brightness multiplier, neutral at one. */
30
+ brightness: number;
19
31
  }>;
20
32
  /** The complete set of system-defined Theme properties. */
21
33
  export type ThemeProperties = Readonly<{
@@ -47,6 +59,10 @@ export declare const themeLimits: Readonly<{
47
59
  minimum: 0;
48
60
  maximum: 1;
49
61
  }>;
62
+ grainAmount: Readonly<{
63
+ minimum: 0;
64
+ maximum: 1;
65
+ }>;
50
66
  animation: Readonly<{
51
67
  minimum: 0;
52
68
  maximum: 16;
@@ -59,6 +75,26 @@ export declare const themeLimits: Readonly<{
59
75
  minimum: 0;
60
76
  maximum: 1;
61
77
  }>;
78
+ distortion: Readonly<{
79
+ minimum: 0;
80
+ maximum: 140;
81
+ }>;
82
+ waves: Readonly<{
83
+ minimum: 0;
84
+ maximum: 40;
85
+ }>;
86
+ ripples: Readonly<{
87
+ minimum: 0;
88
+ maximum: 40;
89
+ }>;
90
+ saturation: Readonly<{
91
+ minimum: 1;
92
+ maximum: 2.6;
93
+ }>;
94
+ brightness: Readonly<{
95
+ minimum: 1;
96
+ maximum: 1.12;
97
+ }>;
62
98
  }>;
63
99
  }>;
64
100
  /** Complete standard Theme available to every environment. */
package/dist/theme.js CHANGED
@@ -4,23 +4,35 @@ export const themeLimits = Object.freeze({
4
4
  radius: Object.freeze({ minimum: 6, maximum: 18 }),
5
5
  surface: Object.freeze({
6
6
  grain: Object.freeze({ minimum: 0, maximum: 1 }),
7
+ grainAmount: Object.freeze({ minimum: 0, maximum: 1 }),
7
8
  animation: Object.freeze({ minimum: 0, maximum: 16 }),
8
9
  backdrop: Object.freeze({ minimum: 0, maximum: 24 }),
9
- opacity: Object.freeze({ minimum: 0, maximum: 1 })
10
+ opacity: Object.freeze({ minimum: 0, maximum: 1 }),
11
+ distortion: Object.freeze({ minimum: 0, maximum: 140 }),
12
+ waves: Object.freeze({ minimum: 0, maximum: 40 }),
13
+ ripples: Object.freeze({ minimum: 0, maximum: 40 }),
14
+ saturation: Object.freeze({ minimum: 1, maximum: 2.6 }),
15
+ brightness: Object.freeze({ minimum: 1, maximum: 1.12 })
10
16
  })
11
17
  });
12
18
  /** Complete standard Theme available to every environment. */
13
19
  export const standardTheme = createThemeSnapshot({
14
- background: "#f5f4ee",
20
+ background: "#fffff5",
15
21
  foreground: "#183447",
16
22
  accent: "#4c9cff",
17
23
  spacing: 12,
18
24
  radius: 10,
19
25
  surface: {
20
- grain: 0.04,
26
+ grain: 0,
27
+ grainAmount: 0,
21
28
  animation: 0,
22
29
  backdrop: 0,
23
- opacity: 1
30
+ opacity: 1,
31
+ distortion: 0,
32
+ waves: 0,
33
+ ripples: 0,
34
+ saturation: 1,
35
+ brightness: 1
24
36
  }
25
37
  });
26
38
  /** Creates a complete immutable Theme snapshot at the contract boundary. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phreshos/core",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "Environment-neutral contracts and domain objects for PhreshOS Programs.",
5
5
  "type": "module",
6
6
  "sideEffects": false,