Skip to content

An open-source, self-hosted system for apps built with web technologies.

Compose Client titles before startup

zohayrslileh1501f1945917
diff --git a/bun.lock b/bun.lock
index d4b12e2..3048018 100644
--- a/bun.lock
+++ b/bun.lock
@@ -25,7 +25,7 @@
"devDependencies": {
"@babel/core": "^7.29.7",
"@babel/plugin-proposal-decorators": "^7.29.7",
- "@phreshos/core": "^0.1.1",
+ "@phreshos/core": "^0.1.2",
"@phreshos/react-ui": "^0.1.0",
"@rolldown/plugin-babel": "^0.2.3",
"@tailwindcss/vite": "^4.3.3",
@@ -229,7 +229,7 @@
"@oxc-project/types": ["@oxc-project/[email protected]", "", {}, "sha512-nuhZIOLuI6TFQ32I/WnUx+SCPY7SdSKwgnFHydAuoS1+Z4BRcaP+RRJmGzl9lw+0OFF7UmaESf7KQRXaNLHypg=="],
- "@phreshos/core": ["@phreshos/[email protected]", "", {}, "sha512-R+4KkGJ/VjPAOLwkQfmTiEE//PPs8JUuxEefhH7c0XVRgs1UjEnfoEZMxp+f9hVxlSM4RGmURaqvubJk3BuqUA=="],
+ "@phreshos/core": ["@phreshos/[email protected]", "", {}, "sha512-MfgtXcdZxj4h6xM74w40s7rihOmJZJe9Ht6kON2HrjDDmIhOmYE5wZq5s3I0YJXcXYjhbLipIDm9YJL9bXLo0A=="],
"@phreshos/react-ui": ["@phreshos/[email protected]", "", { "dependencies": { "react-aria-components": "^1.20.0" }, "peerDependencies": { "@phreshos/core": "^0.1.1", "react": "^19.2.0", "react-dom": "^19.2.0" } }, "sha512-3ipOna2nSUn7vzL74CAwnpdaVJtyq7z6dPM0bPiEYafv3+nTrwtC3+otdScM1gfj+9kUfjn1YA0LmcBuuNOp6w=="],
diff --git a/package.json b/package.json
index 844ad07..d10ba8f 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "phreshos",
"displayName": "PhreshOS",
- "version": "0.1.1",
+ "version": "0.1.2",
"description": "The PhreshOS server, desktop, and authoritative system runtime.",
"type": "module",
"private": true,
@@ -30,8 +30,9 @@
"build": "node --import tsx source/build.ts",
"start": "node --run build && node dist/server/main.js",
"pack": "node --run build && node --import tsx source/pack.ts",
+ "verify:contracts": "node --import tsx scripts/verify-client-launch.mjs",
"verify:distribution": "node scripts/verify-distribution.mjs",
- "verify": "node --run check && node --run verify:distribution"
+ "verify": "node --run check && node --run verify:contracts && node --run verify:distribution"
},
"dependencies": {
"@fontsource/roboto": "^5.3.0",
@@ -54,7 +55,7 @@
"devDependencies": {
"@babel/core": "^7.29.7",
"@babel/plugin-proposal-decorators": "^7.29.7",
- "@phreshos/core": "^0.1.1",
+ "@phreshos/core": "^0.1.2",
"@phreshos/react-ui": "^0.1.0",
"@rolldown/plugin-babel": "^0.2.3",
"@tailwindcss/vite": "^4.3.3",
diff --git a/scripts/verify-client-launch.mjs b/scripts/verify-client-launch.mjs
new file mode 100644
index 0000000..7fde9a1
--- /dev/null
+++ b/scripts/verify-client-launch.mjs
@@ -0,0 +1,22 @@
+import assert from "node:assert/strict"
+import ProgramManager from "../source/server/core/link-manager/auth-manager/program-manager/program-manager.ts"
+
+const manager = {
+ authManager: {
+ processManager: {
+ processes: new Map()
+ }
+ }
+}
+
+const program = {
+ client: {},
+ clientLocation: "/client",
+ title: "Declared title"
+}
+
+const shape = overrides => ProgramManager.prototype.clientShape.call(manager, program, overrides)
+
+assert.equal(shape({ title: "Fetched title" }).title, "Fetched title")
+assert.equal(shape({}).title, "Declared title")
+assert.throws(() => shape({ title: 42 }), /title must be text/)
diff --git a/source/client/view/desktop/client-host/host.ts b/source/client/view/desktop/client-host/host.ts
index 2ee33fc..79abe75 100644
--- a/source/client/view/desktop/client-host/host.ts
+++ b/source/client/view/desktop/client-host/host.ts
@@ -523,9 +523,7 @@ export default function host(authManager: AuthManager, pane: string, space: (lay
// cannot read either off its own description.
layer: shown.layer,
- location: shown.location,
-
- surface: shown.surface
+ location: shown.location
}]
}
diff --git a/source/server/core/link-manager/auth-manager/process-manager/process-manager.ts b/source/server/core/link-manager/auth-manager/process-manager/process-manager.ts
index 94912c3..54d2407 100644
--- a/source/server/core/link-manager/auth-manager/process-manager/process-manager.ts
+++ b/source/server/core/link-manager/auth-manager/process-manager/process-manager.ts
@@ -663,7 +663,7 @@ export default class ProcessManager extends TheLink {
private window(program: Program, shape: Shape) {
- const shown = { title: program.title, url: program.clientRoot, layer: shape.layer, location: shape.location }
+ const shown = { title: shape.title, url: program.clientRoot, layer: shape.layer, location: shape.location }
return new Window(shown, shape.position, shape.size, ++this.highest, shape.minimize)
}
@@ -1459,9 +1459,7 @@ export default class ProcessManager extends TheLink {
// which layer it is the front of.
layer: window.layer,
- location: window.location,
-
- surface: window.surface
+ location: window.location
}]
}
@@ -1967,8 +1965,6 @@ export default class ProcessManager extends TheLink {
if (!changed) return null
- this.said(identity, "surface", window.surface)
-
return { identity, window }
}
@@ -2132,6 +2128,8 @@ function isHandleAddress(value: unknown): value is HandleAddress {
// window opens as.
interface ShapeBase {
+ title: string
+
position: Position
size: Size
diff --git a/source/server/core/link-manager/auth-manager/program-manager/program-manager.ts b/source/server/core/link-manager/auth-manager/program-manager/program-manager.ts
index a558402..106d993 100644
--- a/source/server/core/link-manager/auth-manager/program-manager/program-manager.ts
+++ b/source/server/core/link-manager/auth-manager/program-manager/program-manager.ts
@@ -1102,6 +1102,8 @@ export default class ProgramManager extends TheLink {
if (typeof asked !== "object" || asked === null || Array.isArray(asked)) throw new Error("A client launch must be a named shape")
+ if (asked.title !== undefined && typeof asked.title !== "string") throw new Error("A launch client's title must be text")
+
for (const [what, value] of [["size", asked.size], ["position", asked.position]] as const) {
if (value === undefined) continue
@@ -1123,6 +1125,8 @@ export default class ProgramManager extends TheLink {
return {
+ title: asked.title ?? program.title,
+
position: asked.position ?? client.position ?? { x: 120 + shift, y: 80 + shift },
size: asked.size ?? client.size ?? { width: 520, height: 340 },
@@ -1215,6 +1219,8 @@ export interface Launch {
// than a fact about a launch.
export interface LaunchClient {
+ title?: string
+
size?: Size
position?: Position