@phreshos/node 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
@@ -1,66 +1,74 @@
1
- # @phreshos/node
1
+ # `@phreshos/node`
2
2
 
3
- The Node.js interface for a running PhreshOS System and local Program projects.
3
+ Node.js access to a running PhreshOS System and local Program projects.
4
4
 
5
- ```ts
6
- import { Project, System } from "@phreshos/node"
5
+ The Node SDK exposes the same System model used inside Server Endpoints and adds
6
+ only connection lifecycle and project tooling.
7
7
 
8
- const project = await Project.open()
9
- const system = await System.connect()
8
+ ## Installation
10
9
 
11
- for await (const chunk of await project.install(system)) {
12
- process[chunk.stream].write(chunk.text)
13
- }
10
+ | Package manager | Command |
11
+ | --- | --- |
12
+ | npm | `npm install @phreshos/node` |
13
+ | pnpm | `pnpm add @phreshos/node` |
14
+ | Bun | `bun add @phreshos/node` |
15
+ | Yarn | `yarn add @phreshos/node` |
16
+
17
+ ## System
14
18
 
15
- // This is the same transport-neutral System contract used by Server Programs.
19
+ ```ts
20
+ import { System } from "@phreshos/node"
21
+
22
+ const system = await System.connect()
16
23
  const programs = await system.program.list()
17
24
 
18
25
  await system.disconnect()
19
26
  ```
20
27
 
21
- `Project.open()` discovers `phresh.config.ts` from the current working
22
- directory by default. `System.connect()` resolves its home from an explicit
23
- argument, then `PHRESHOS_HOME`, then the current user's `.phreshos` directory.
28
+ The transport is not public API. Code receives the same System, Program,
29
+ Process, Endpoint, Service, Window, storage, and upload handles used by the
30
+ Server SDK. `disconnect()` exists because external Node code owns the
31
+ connection.
24
32
 
25
- Project operations remain available without duplicating CLI logic:
33
+ ## Project
26
34
 
27
35
  ```ts
28
- const project = await Project.open() // process.cwd()
36
+ import { Project, System } from "@phreshos/node"
37
+
38
+ const project = await Project.open()
29
39
  const system = await System.connect()
30
40
 
31
- await project.pack()
32
41
  for await (const event of await project.start(system, { signal })) {
33
- // started, output, exited
34
- }
35
-
36
- for await (const event of await project.dev(system, { signal })) {
37
- // started, output, exited
38
- }
39
-
40
- for await (const chunk of await project.install(system)) {
41
- // stdout or stderr
42
+ console.log(event)
42
43
  }
43
44
 
44
45
  await system.disconnect()
45
46
  ```
46
47
 
47
- These shortcuts return the original `program.install()` or
48
- `program.process.run()` generator; they do not consume or mirror its events.
49
- The CLI owns presentation and its additional development Client server.
48
+ `Project` owns authoring concerns: builds, development and production
49
+ definitions, installation, execution shortcuts, and packaging. The System
50
+ receives only the resulting Program definition.
50
51
 
51
- For custom composition, resolve either Program definition explicitly:
52
+ `Project.open()` starts from the current working directory by default.
53
+ `System.connect()` resolves an explicit System home, then `PHRESHOS_HOME`,
54
+ then the current owner's default System home.
52
55
 
53
- ```ts
54
- const definition = project.productionDefinition()
55
- // const definition = project.developmentDefinition()
56
+ ## Development
56
57
 
57
- const program = await system.forceCreateProgram(definition)
58
- const lifecycle = program.process.run({}, { signal })
58
+ ```sh
59
+ bun install --frozen-lockfile
60
+ bun run verify
59
61
  ```
60
62
 
61
- The lower-level System API stays composable: use
62
- `system.forceCreateProgram(definition)` to replace one runtime Program, and
63
- `program.process.run(launch, { signal })` when one Process should live exactly
64
- as long as its asynchronous iterator. Node also exports the runtime `Program`,
65
- `Process`, `Endpoint`, `Server`, and `Client` constructors; handles are
66
- canonical within one connected `System` and support `instanceof`.
63
+ See the [Node SDK documentation](https://github.com/PhreshOS/docs/blob/main/content/docs/sdks/node.mdx)
64
+ for the public model.
65
+
66
+ ## Repository boundary
67
+
68
+ This repository owns the external Node connection and local-project API. Core
69
+ owns the domain model, Server owns the Endpoint runtime adapter, and CLI owns
70
+ terminal presentation and native service management.
71
+
72
+ ## License
73
+
74
+ Licensed under the [MIT License](LICENSE). Copyright © 2026 Zohayr SLILEH.
package/dist/traffic.d.ts CHANGED
@@ -15,7 +15,7 @@ export declare class EndpointTrafficHandle<Definitions extends object = {}> exte
15
15
  event: string;
16
16
  questionId: string;
17
17
  message: Readonly<{
18
- to: import("@phreshos/core").Server<{}>;
18
+ to: import("@phreshos/core").Server<{}> | null;
19
19
  payload: Payload;
20
20
  }>;
21
21
  }>>;
@@ -28,7 +28,7 @@ export declare class ServerTrafficHandle<Definitions extends object = {}> extend
28
28
  event: string;
29
29
  questionId: string;
30
30
  message: Readonly<{
31
- to: Endpoint<{}>;
31
+ to: Endpoint<{}> | null;
32
32
  outcome: import("@phreshos/core").Outcome<Result>;
33
33
  }>;
34
34
  }>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phreshos/node",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "Node.js access to PhreshOS and Program projects.",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",
@@ -36,7 +36,7 @@
36
36
  "prepack": "node --run build"
37
37
  },
38
38
  "dependencies": {
39
- "@phreshos/core": "^0.1.30",
39
+ "@phreshos/core": "^0.1.31",
40
40
  "adm-zip": "^0.6.0",
41
41
  "jiti": "^2.7.0"
42
42
  },