An open-source, self-hosted system for apps built with web technologies.
Release System 0.1.13
zohayrslileh935f5cbf71c1
diff --git a/bun.lock b/bun.lockindex 932e2e6..42fc99a 100644--- a/bun.lock+++ b/bun.lock@@ -12,7 +12,6 @@"gsap": "^3.15.0","hono": "^4.13.2","keyv": "^5.6.0",- "lz-string": "^1.5.0","node-rsa": "^2.0.0","react": "^19.2.8","react-dom": "^19.2.8",@@ -423,8 +422,6 @@"lru-cache": ["[email protected]", "", { "dependencies": { "yallist": "^3.0.2" } }, "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w=="],- "lz-string": ["[email protected]", "", { "bin": { "lz-string": "bin/bin.js" } }, "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ=="],-"magic-string": ["[email protected]", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.5" } }, "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ=="],"ms": ["[email protected]", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="],diff --git a/package.json b/package.jsonindex ccf078f..7a30bd6 100644--- a/package.json+++ b/package.json@@ -1,7 +1,7 @@{"name": "phreshos","displayName": "PhreshOS",- "version": "0.1.12",+ "version": "0.1.13","description": "The PhreshOS server, desktop, and authoritative system runtime.","type": "module","private": true,@@ -42,7 +42,6 @@"gsap": "^3.15.0","hono": "^4.13.2","keyv": "^5.6.0",- "lz-string": "^1.5.0","node-rsa": "^2.0.0","react": "^19.2.8","react-dom": "^19.2.8",diff --git a/source/client/core/application.ts b/source/client/core/application.tsindex dd0ff44..7a52ce9 100644--- a/source/client/core/application.ts+++ b/source/client/core/application.ts@@ -3,7 +3,6 @@ import { type ProxyOutcome, type ProxyRequest, type ProxyResponse, proxyMediaTypimport { storageMediaType, type StorageRequest } from "@server/core/protocol/storage"import { frame, frameBlob, unframe } from "@libs/framing"import superjson from "@libs/superjson"-import LZString from "lz-string"export default class Application {@@ -29,9 +28,9 @@ export default class Application {this.clientLink = new ClientLink(this.doors.link)- this.clientLink.setSerialize(data => LZString.compressToBase64(superjson.stringify(data)))+ this.clientLink.setSerialize(data => superjson.stringify(data))- this.clientLink.setDeserialize(data => superjson.parse(LZString.decompressFromBase64(data)))+ this.clientLink.setDeserialize(data => superjson.parse(data))}// A finite browser body keeps its length, so HTTP/1 can stream it from itsdiff --git a/source/client/core/link-manager/auth-manager/process-manager/process-manager.ts b/source/client/core/link-manager/auth-manager/process-manager/process-manager.tsindex 458dfe5..b07ea12 100644--- a/source/client/core/link-manager/auth-manager/process-manager/process-manager.ts+++ b/source/client/core/link-manager/auth-manager/process-manager/process-manager.ts@@ -334,9 +334,9 @@ export default class ProcessManager extends TheLink {}@Subscribe("/end-end")- protected async endEndHandle(identity: string, json: string) {+ protected async endEndHandle(identity: string, values: unknown[]) {- this.$inbound.publish("/pane", identity, json).catch(() => undefined)+ this.$inbound.publish("/pane", identity, values).catch(() => undefined)}}diff --git a/source/client/core/link-manager/auth-manager/process-manager/process.ts b/source/client/core/link-manager/auth-manager/process-manager/process.tsindex 2c2fe2d..27b899b 100644--- a/source/client/core/link-manager/auth-manager/process-manager/process.ts+++ b/source/client/core/link-manager/auth-manager/process-manager/process.ts@@ -75,7 +75,7 @@ export default class Process {// The program's own words, to its other half.public async endEnd(...args: unknown[]) {- await this.processManager.$outbound.publish("/frame/end-end", this.identity, JSON.stringify(args))+ await this.processManager.$outbound.publish("/frame/end-end", this.identity, args)}public serverStarted() {diff --git a/source/client/view/desktop/client-host/client-host.ts b/source/client/view/desktop/client-host/client-host.tsindex 751f987..776dcf5 100644--- a/source/client/view/desktop/client-host/client-host.ts+++ b/source/client/view/desktop/client-host/client-host.ts@@ -110,19 +110,17 @@ export default function useClientHost(desktop: RefObject<HTMLDivElement | null>,useEffect(() => pointer.listen(), [pointer])- // The process-to-interface leg rides the same tunnel the echoes- // land on: an end-end arrives as (identity, json) and is posted into- // its pane in its envelope. The op's own echo shares the event name- // with a null payload — the type guard tells them apart.+ // The process-to-interface leg rides the same tunnel the echoes land on:+ // an end-end arrives as (identity, values) and is posted into its pane in+ // its envelope. The op's own echo shares the event name with a null+ // payload — the type guard tells them apart.const inbound = ReactTunnel.useFactory(authManager.processManager.$inbound)inbound.useSubscribe("/end-end", useCallback((...results: unknown[]) => {- const [identity, json] = results+ const [identity, values] = results- if (typeof identity !== "string" || typeof json !== "string") return-- const values = JSON.parse(json) as unknown[]+ if (typeof identity !== "string" || !Array.isArray(values)) returnif ((values[0] === "answer" || values[0] === "wait") && typeof values[1] === "string") boundaries.current.get(identity)?.deliver("end-end", ...values).catch(() => undefined)@@ -136,13 +134,13 @@ export default function useClientHost(desktop: RefObject<HTMLDivElement | null>,// Observed publications and request answering remain separate routes.inbound.useSubscribe("/observed", useCallback((...results: unknown[]) => {- const [observer, owner, subscription, json] = results+ const [observer, owner, subscription, values] = results- if (typeof observer !== "string" || typeof owner !== "string" || typeof subscription !== "string" || typeof json !== "string") return+ if (typeof observer !== "string" || typeof owner !== "string" || typeof subscription !== "string" || !Array.isArray(values)) returnif (frameOwners.current.get(observer) !== owner) return- traffic.emit(observer, "observed", subscription, ...JSON.parse(json) as unknown[]).catch(() => undefined)+ traffic.emit(observer, "observed", subscription, ...values).catch(() => undefined)}, [sources, traffic]))@@ -150,13 +148,13 @@ export default function useClientHost(desktop: RefObject<HTMLDivElement | null>,// appear in directed traffic observations.inbound.useSubscribe("/emitted", useCallback((...results: unknown[]) => {- const [observer, owner, subscription, json] = results+ const [observer, owner, subscription, values] = results- if (typeof observer !== "string" || typeof owner !== "string" || typeof subscription !== "string" || typeof json !== "string") return+ if (typeof observer !== "string" || typeof owner !== "string" || typeof subscription !== "string" || !Array.isArray(values)) returnif (frameOwners.current.get(observer) !== owner) return- traffic.emit(observer, "emitted", subscription, ...JSON.parse(json) as unknown[]).catch(() => undefined)+ traffic.emit(observer, "emitted", subscription, ...values).catch(() => undefined)}, [sources, traffic]))@@ -164,13 +162,13 @@ export default function useClientHost(desktop: RefObject<HTMLDivElement | null>,// reach only the frame lease that registered the opaque subscription.inbound.useSubscribe("/service-event", useCallback((...results: unknown[]) => {- const [observer, owner, subscription, json] = results+ const [observer, owner, subscription, values] = results- if (typeof observer !== "string" || typeof owner !== "string" || typeof subscription !== "string" || typeof json !== "string") return+ if (typeof observer !== "string" || typeof owner !== "string" || typeof subscription !== "string" || !Array.isArray(values)) returnif (frameOwners.current.get(observer) !== owner) return- traffic.emit(observer, "service-event", subscription, ...JSON.parse(json) as unknown[]).catch(() => undefined)+ traffic.emit(observer, "service-event", subscription, ...values).catch(() => undefined)}, [sources, traffic]))@@ -275,8 +273,8 @@ export default function useClientHost(desktop: RefObject<HTMLDivElement | null>,// The interface wall: an iframe's end-end relays to its process's// other end; its end-host terminates here, handled by the desktop —- // the interface's host. Args cross The Link as standard JSON in a- // plain string — The Link's serialization never shapes a payload.+ // the interface's host. Args remain one event tuple across The Link; no+ // nested serialization is introduced inside the transport.// A cached iframe may begin executing before passive effects run. Install// its boundary listener during the commit, before the browser can run it,// so the document's first explicit request cannot disappear.diff --git a/source/server/core/link-manager/auth-manager/process-manager/client-process-forwarder.ts b/source/server/core/link-manager/auth-manager/process-manager/client-process-forwarder.tsindex e3031a2..e235df1 100644--- a/source/server/core/link-manager/auth-manager/process-manager/client-process-forwarder.ts+++ b/source/server/core/link-manager/auth-manager/process-manager/client-process-forwarder.ts@@ -62,7 +62,7 @@ export default class ClientProcessForwarder {const values = this.shapeObservedValues(event === null ? [word, ...payload] : payload)- this.authManager.publishToConnection(this.connection, "/process/observed", this.pane, this.owner, subscription, JSON.stringify(values)).catch(() => undefined)+ this.authManager.publishToConnection(this.connection, "/process/observed", this.pane, this.owner, subscription, values).catch(() => undefined)}, reportImpossible ? reason => this.impossible(subscription, reason) : undefined)this.observations.set(subscription, stop)@@ -123,7 +123,7 @@ export default class ClientProcessForwarder {const values = event === null ? [word, payload] : [payload]- this.authManager.publishToConnection(this.connection, "/process/emitted", this.pane, this.owner, subscription, JSON.stringify(values)).catch(() => undefined)+ this.authManager.publishToConnection(this.connection, "/process/emitted", this.pane, this.owner, subscription, values).catch(() => undefined)}, reportImpossible ? reason => this.impossibleFollow(subscription, reason) : undefined)this.endpointSubscriptions.set(subscription, stop)@@ -149,7 +149,7 @@ export default class ClientProcessForwarder {const values = event === null ? [word, payload] : [payload]- return this.authManager.publishToConnection(this.connection, "/process/service-event", this.pane, this.owner, subscription, JSON.stringify(values)).catch(() => undefined)+ return this.authManager.publishToConnection(this.connection, "/process/service-event", this.pane, this.owner, subscription, values).catch(() => undefined)})this.serviceSubscriptions.set(subscription, stop)@@ -199,6 +199,6 @@ export default class ClientProcessForwarder {private async send(values: unknown[]) {- await this.authManager.publishToConnection(this.connection, "/process/end-end", this.pane, JSON.stringify(values))+ await this.authManager.publishToConnection(this.connection, "/process/end-end", this.pane, values)}}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.tsindex ab89957..071a647 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@@ -404,7 +404,7 @@ export default class ProcessManager extends TheLink {const answer = ["answer", values[1], values[2], values[3], failed(new Error(reason))]- this.authManager.publishToConnection(connection, "/process/end-end", pane, JSON.stringify(answer)).catch(() => undefined)+ this.authManager.publishToConnection(connection, "/process/end-end", pane, answer).catch(() => undefined)}public releaseConnection(connection: string) {@@ -2054,12 +2054,11 @@ export default class ProcessManager extends TheLink {}@Subscribe("/frame/end-end")- protected async endEndClientFrame(connection: string, identity: string, json: string) {+ protected async endEndClientFrame(connection: string, identity: string, values: unknown[]) {- // The payload crossed The Link as standard JSON in a plain- // string — parsed here, delivered in its envelope: an end knows- // who speaks by the route name it hears.- const values = JSON.parse(json) as unknown[]+ // The payload crosses The Link once as its native event tuple. The+ // route still supplies the speaker; no nested wire format is needed.+ if (!Array.isArray(values)) returnif (values[0] === "wait" && typeof values[1] === "string" && !this.retainClientQuestion(connection, identity, values[1], identity)) {diff --git a/source/server/view/link.ts b/source/server/view/link.tsindex 7154c08..9b3c19d 100644--- a/source/server/view/link.ts+++ b/source/server/view/link.ts@@ -2,7 +2,6 @@ import ServerLink from "@libs/the-link/plugins/server-link/server-link"import { upgradeWebSocket } from "@hono/node-server"import Application from "@server/core/application"import superjson from "@libs/superjson"-import LZString from "lz-string"import { failed, succeeded } from "@server/core/outcome"export default function (application: Application, debugging: boolean) {@@ -11,9 +10,9 @@ export default function (application: Application, debugging: boolean) {if (debugging) serverLink.enableDebugging()- serverLink.setSerialize(data => LZString.compressToBase64(superjson.stringify(data)))+ serverLink.setSerialize(data => superjson.stringify(data))- serverLink.setDeserialize(data => superjson.parse(LZString.decompressFromBase64(data)))+ serverLink.setDeserialize(data => superjson.parse(data))serverLink.onSubscribe(function (socketLink) {