From f1ec50628f722ad2ee7bdac08f394d17cc3b1045 Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Fri, 6 Nov 2026 22:39:09 +0100 Subject: [PATCH 01/13] chore(deps): pin the monorepo at c4d6fe182 The kit and core move together, and the localized messages come from the same checkout. The server shared no pin with the stream package; it takes the same rev now. --- packages/stream/Cargo.lock | 23 ++++++++++++++++------- packages/stream/Cargo.toml | 8 ++++---- server/Cargo.lock | 4 ++-- server/Cargo.toml | 5 ++--- 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/packages/stream/Cargo.lock b/packages/stream/Cargo.lock index 0812a02..13c2bd1 100644 --- a/packages/stream/Cargo.lock +++ b/packages/stream/Cargo.lock @@ -531,7 +531,7 @@ dependencies = [ [[package]] name = "fec-rs" version = "0.1.0" -source = "git+https://git.unom.io/unom/punktfunk?rev=12e4dfd1ba7855d0043a15c2939fc923a85771ef#12e4dfd1ba7855d0043a15c2939fc923a85771ef" +source = "git+https://git.unom.io/unom/punktfunk?rev=c4d6fe182882dd1874afc47e78bbe7ff8d8c822c#c4d6fe182882dd1874afc47e78bbe7ff8d8c822c" [[package]] name = "fiat-crypto" @@ -996,11 +996,12 @@ dependencies = [ [[package]] name = "pf-client-core" -version = "0.45.0" -source = "git+https://git.unom.io/unom/punktfunk?rev=12e4dfd1ba7855d0043a15c2939fc923a85771ef#12e4dfd1ba7855d0043a15c2939fc923a85771ef" +version = "0.46.0" +source = "git+https://git.unom.io/unom/punktfunk?rev=c4d6fe182882dd1874afc47e78bbe7ff8d8c822c#c4d6fe182882dd1874afc47e78bbe7ff8d8c822c" dependencies = [ "anyhow", "cfg_aliases", + "pf-l10n", "punktfunk-core", "rand", "serde", @@ -1011,11 +1012,12 @@ dependencies = [ [[package]] name = "pf-console-ui" -version = "0.45.0" -source = "git+https://git.unom.io/unom/punktfunk?rev=12e4dfd1ba7855d0043a15c2939fc923a85771ef#12e4dfd1ba7855d0043a15c2939fc923a85771ef" +version = "0.46.0" +source = "git+https://git.unom.io/unom/punktfunk?rev=c4d6fe182882dd1874afc47e78bbe7ff8d8c822c#c4d6fe182882dd1874afc47e78bbe7ff8d8c822c" dependencies = [ "anyhow", "pf-client-core", + "pf-l10n", "punktfunk-core", "serde", "serde_json", @@ -1024,6 +1026,11 @@ dependencies = [ "tracing", ] +[[package]] +name = "pf-l10n" +version = "0.46.0" +source = "git+https://git.unom.io/unom/punktfunk?rev=c4d6fe182882dd1874afc47e78bbe7ff8d8c822c#c4d6fe182882dd1874afc47e78bbe7ff8d8c822c" + [[package]] name = "pin-project-lite" version = "0.2.17" @@ -1104,8 +1111,8 @@ dependencies = [ [[package]] name = "punktfunk-core" -version = "0.45.0" -source = "git+https://git.unom.io/unom/punktfunk?rev=12e4dfd1ba7855d0043a15c2939fc923a85771ef#12e4dfd1ba7855d0043a15c2939fc923a85771ef" +version = "0.46.0" +source = "git+https://git.unom.io/unom/punktfunk?rev=c4d6fe182882dd1874afc47e78bbe7ff8d8c822c#c4d6fe182882dd1874afc47e78bbe7ff8d8c822c" dependencies = [ "aes-gcm", "aws-lc-rs", @@ -1116,11 +1123,13 @@ dependencies = [ "if-addrs", "libc", "opus", + "pf-l10n", "quinn", "quinn-udp", "rcgen", "reed-solomon-simd", "rustls", + "rustls-webpki", "serde", "sha2 0.11.0", "socket2", diff --git a/packages/stream/Cargo.toml b/packages/stream/Cargo.toml index d11fb62..73de2e3 100644 --- a/packages/stream/Cargo.toml +++ b/packages/stream/Cargo.toml @@ -15,7 +15,7 @@ name = "punktfunk-client-web" path = "rust/main.rs" # The punktfunk crates follow the host's release tags, all three together: the client speaks that -# release's wire. This is main at 12e4dfd1b, ahead of v0.45.0. +# release's wire. This is main at c4d6fe182, ahead of v0.46.0. [dependencies] anyhow = "1" # The device fingerprint: SHA-256 of the WebCrypto key's SPKI, which is what the host stores. @@ -23,7 +23,7 @@ anyhow = "1" sha2 = "0.11" # `transport::Transport`, the wire codecs and the SPAKE2 ceremony. `pake`, not `quic`: the # browser plane is WebTransport, so the ceremony is wanted and the quinn runtime under it is not. -punktfunk-core = { git = "https://git.unom.io/unom/punktfunk", rev = "12e4dfd1ba7855d0043a15c2939fc923a85771ef", default-features = false, features = ["pake"] } +punktfunk-core = { git = "https://git.unom.io/unom/punktfunk", rev = "c4d6fe182882dd1874afc47e78bbe7ff8d8c822c", default-features = false, features = ["pake"] } # wasm only. Off it this is a bin that prints how to build it, so `cargo test` on a developer's # desktop stays green and does not resolve skia-safe for a target that wants a second Skia @@ -32,12 +32,12 @@ punktfunk-core = { git = "https://git.unom.io/unom/punktfunk", rev = "12e4dfd1ba # The shell itself. `default-features = false`: `vulkan-overlay` is the desktop session binary's, # and it would put `vulkan` on skia-safe and change the prebuilt key away from # `ganesh-gl-jpegd-jpege-pdf-textlayout`, the one build.sh downloads for this target. -pf-console-ui = { git = "https://git.unom.io/unom/punktfunk", rev = "12e4dfd1ba7855d0043a15c2939fc923a85771ef", default-features = false } +pf-console-ui = { git = "https://git.unom.io/unom/punktfunk", rev = "c4d6fe182882dd1874afc47e78bbe7ff8d8c822c", default-features = false } # The bridge's JSON both ways: the model the page pushes, what the shell raises. serde = "1" serde_json = "1" # The portable half — `trust::Settings` for the snapshot store the shell loads from. -pf-client-core = { git = "https://git.unom.io/unom/punktfunk", rev = "12e4dfd1ba7855d0043a15c2939fc923a85771ef", default-features = false } +pf-client-core = { git = "https://git.unom.io/unom/punktfunk", rev = "c4d6fe182882dd1874afc47e78bbe7ff8d8c822c", default-features = false } # The SAME line pf-console-ui's wasm block carries, features included: two feature sets in one # build resolve two prebuilt keys, and the second one puts a source build of Skia on the critical # path. Only `host.rs` names it, to build the context and wrap the canvas. diff --git a/server/Cargo.lock b/server/Cargo.lock index 2b37325..a451132 100644 --- a/server/Cargo.lock +++ b/server/Cargo.lock @@ -544,7 +544,7 @@ checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" [[package]] name = "fec-rs" version = "0.1.0" -source = "git+https://git.unom.io/unom/punktfunk?rev=f29f933fa365cb737bd57ae9079adf2c96d8fda8#f29f933fa365cb737bd57ae9079adf2c96d8fda8" +source = "git+https://git.unom.io/unom/punktfunk?rev=c4d6fe182882dd1874afc47e78bbe7ff8d8c822c#c4d6fe182882dd1874afc47e78bbe7ff8d8c822c" [[package]] name = "find-msvc-tools" @@ -1408,7 +1408,7 @@ dependencies = [ [[package]] name = "punktfunk-core" version = "0.46.0" -source = "git+https://git.unom.io/unom/punktfunk?rev=f29f933fa365cb737bd57ae9079adf2c96d8fda8#f29f933fa365cb737bd57ae9079adf2c96d8fda8" +source = "git+https://git.unom.io/unom/punktfunk?rev=c4d6fe182882dd1874afc47e78bbe7ff8d8c822c#c4d6fe182882dd1874afc47e78bbe7ff8d8c822c" dependencies = [ "aes-gcm", "chacha20poly1305", diff --git a/server/Cargo.toml b/server/Cargo.toml index adaa141..82462f9 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -40,9 +40,8 @@ tracing-subscriber = { version = "0.3", features = ["env-filter"] } # core's `tls` installs: a second rustls provider in the tree makes `ClientConfig::builder()` panic. wtransport = { version = "0.7", default-features = false, features = ["aws-lc-rs"] } # The same PinVerify and address ranking the native clients use, and the route table, address -# classes and plane attestation check the host itself reads. Ahead of packages/stream's pin, -# which moves with the wire. -punktfunk-core = { git = "https://git.unom.io/unom/punktfunk", rev = "f29f933fa365cb737bd57ae9079adf2c96d8fda8", default-features = false, features = ["tls"] } +# classes and plane attestation check the host itself reads. The same rev as packages/stream. +punktfunk-core = { git = "https://git.unom.io/unom/punktfunk", rev = "c4d6fe182882dd1874afc47e78bbe7ff8d8c822c", default-features = false, features = ["tls"] } [dev-dependencies] tower = { version = "0.5", features = ["util"] } From a5dbc9202416632633b39fa4ddce59fdf5263e8b Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Fri, 6 Nov 2026 22:52:46 +0100 Subject: [PATCH 02/13] feat(l10n): read the pinned monorepo's messages through Paraglide The messages live in the monorepo's l10n crate, and one pin moves the kit and its words together. A script finds the checkout through cargo metadata and copies the common, client, browser and host parts for the shipped languages into apps/web/l10n, which stays untracked. It writes the same list into the inlang settings, so the shipped languages have one source. The page follows the browser's language list and has no switch. The app's check, test and build, and Storybook, run the script first, and so does the stream package's test. CI installs the pinned toolchain before the web job needs cargo. --- .github/workflows/ci.yml | 4 + .gitignore | 2 + apps/web/package.json | 9 + apps/web/project.inlang/settings.json | 16 + apps/web/tsconfig.json | 3 + apps/web/vite.config.ts | 12 +- package-lock.json | 1108 ++++++++++++++++++++++--- packages/stream/package.json | 1 + scripts/l10n-messages.mjs | 69 ++ 9 files changed, 1114 insertions(+), 110 deletions(-) create mode 100644 apps/web/project.inlang/settings.json create mode 100644 scripts/l10n-messages.mjs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 33a10e2..c15f7f1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,6 +24,10 @@ jobs: # `@punktfunk/host` comes from the Gitea npm registry (`.npmrc` names the scope). Reads # are anonymous there, so no secret is needed to install. - run: npm ci + # The page's messages come from the pinned monorepo's checkout, which cargo finds + # (`scripts/l10n-messages.mjs`, run by the app's `check`, `test` and `build`). + - run: rustup toolchain install + working-directory: packages/stream - run: npm run check - run: npm test # The screens as Storybook renders them, without the wasm: the stories never start the diff --git a/.gitignore b/.gitignore index 57383f5..86500ad 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,8 @@ node_modules/ /packages/stream/wasm/*.js /packages/stream/wasm/*.wasm /apps/web/dist +/apps/web/l10n +/apps/web/src/paraglide /apps/web/storybook-static /apps/web/screenshots /target diff --git a/apps/web/package.json b/apps/web/package.json index 3449e37..29f6458 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -5,11 +5,18 @@ "type": "module", "description": "The punktfunk web client — the flagship consumer of @punktfunk/stream. React + @unom/ui + Tailwind, the same stack as the host's management console.", "scripts": { + "l10n": "node ../../scripts/l10n-messages.mjs && paraglide-js compile --project ./project.inlang --outdir ./src/paraglide --strategy preferredLanguage baseLocale", + "predev": "npm run l10n", "dev": "vite", + "prebuild": "npm run l10n", "build": "vite build", + "precheck": "npm run l10n", "check": "tsc --noEmit", + "pretest": "npm run l10n", "test": "node --experimental-transform-types --disable-warning=ExperimentalWarning --test 'src/**/*.test.ts'", + "prestorybook": "npm run l10n", "storybook": "storybook dev -p 6006", + "prebuild-storybook": "npm run l10n", "build-storybook": "storybook build", "screenshots": "node tools/screenshots.mjs" }, @@ -29,6 +36,8 @@ "zod": "^4.6.5" }, "devDependencies": { + "@inlang/paraglide-js": "^2.29.3", + "@inlang/plugin-message-format": "^4.6.0", "@storybook/react-vite": "^10.6.0", "@tailwindcss/vite": "^4.3.3", "@types/react": "^19.3.0", diff --git a/apps/web/project.inlang/settings.json b/apps/web/project.inlang/settings.json new file mode 100644 index 0000000..badc069 --- /dev/null +++ b/apps/web/project.inlang/settings.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://inlang.com/schema/project-settings", + "baseLocale": "en", + "locales": ["en"], + "modules": [ + "../../node_modules/@inlang/plugin-message-format/dist/index.js" + ], + "plugin.inlang.messageFormat": { + "pathPattern": [ + "./l10n/browser/{locale}.json", + "./l10n/client/{locale}.json", + "./l10n/common/{locale}.json", + "./l10n/host/{locale}.json" + ] + } +} diff --git a/apps/web/tsconfig.json b/apps/web/tsconfig.json index ef25cbc..ae5484a 100644 --- a/apps/web/tsconfig.json +++ b/apps/web/tsconfig.json @@ -2,6 +2,9 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "noEmit": true, + // Paraglide's compiled messages are JavaScript with JSDoc types, which this reads and does not check. + "allowJs": true, + "checkJs": false, "jsx": "react-jsx", // `vite/client` declares the CSS imports, which TypeScript 7 checks like any other import. "types": ["@webgpu/types", "node", "vite/client"], diff --git a/apps/web/vite.config.ts b/apps/web/vite.config.ts index cc14a9b..1dea5ab 100644 --- a/apps/web/vite.config.ts +++ b/apps/web/vite.config.ts @@ -4,6 +4,7 @@ import { execFileSync } from "node:child_process"; import { fileURLToPath } from "node:url"; +import { paraglideVitePlugin } from "@inlang/paraglide-js"; import tailwindcss from "@tailwindcss/vite"; import react from "@vitejs/plugin-react"; import { defineConfig } from "vite"; @@ -22,7 +23,16 @@ function version(): string { export default defineConfig({ // Relative asset URLs, so the same `dist/` works at a host's root, under a path, or packaged. base: "./", - plugins: [react(), tailwindcss()], + plugins: [ + react(), + tailwindcss(), + // The browser's own language list, with no switch: the page has no setting for it. + paraglideVitePlugin({ + project: "./project.inlang", + outdir: "./src/paraglide", + strategy: ["preferredLanguage", "baseLocale"], + }), + ], // Through the dev proxy the API answers on the page's origin but the WebTransport plane does // not; this tells the engine where it is. Undefined in a real build, so the address the user // typed is used — exactly as designed. diff --git a/package-lock.json b/package-lock.json index 53a974f..bfeb084 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35,6 +35,8 @@ "zod": "^4.6.5" }, "devDependencies": { + "@inlang/paraglide-js": "^2.29.3", + "@inlang/plugin-message-format": "^4.6.0", "@storybook/react-vite": "^10.6.0", "@tailwindcss/vite": "^4.3.3", "@types/react": "^19.3.0", @@ -315,6 +317,218 @@ "node": ">=6.9.0" } }, + "node_modules/@bytecodealliance/jco-node-fs": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@bytecodealliance/jco-node-fs/-/jco-node-fs-0.3.2.tgz", + "integrity": "sha512-yxvqQreNcOQdMsEKZomkSqThtkxrAz3f1Cmy8BsV0UHi9saa2/D1KDB14IAXPYwDq/maS6lCzS+MuMQx6QkUgA==", + "dev": true, + "license": "(Apache-2.0 WITH LLVM-exception)", + "engines": { + "node": ">=20" + }, + "optionalDependencies": { + "@bytecodealliance/jco-node-fs-darwin-arm64": "0.3.2", + "@bytecodealliance/jco-node-fs-darwin-x64": "0.3.2", + "@bytecodealliance/jco-node-fs-linux-arm64-gnu": "0.3.2", + "@bytecodealliance/jco-node-fs-linux-arm64-musl": "0.3.2", + "@bytecodealliance/jco-node-fs-linux-x64-gnu": "0.3.2", + "@bytecodealliance/jco-node-fs-linux-x64-musl": "0.3.2", + "@bytecodealliance/jco-node-fs-win32-arm64-msvc": "0.3.2", + "@bytecodealliance/jco-node-fs-win32-x64-msvc": "0.3.2" + } + }, + "node_modules/@bytecodealliance/jco-node-fs-darwin-arm64": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@bytecodealliance/jco-node-fs-darwin-arm64/-/jco-node-fs-darwin-arm64-0.3.2.tgz", + "integrity": "sha512-WXQq1tRVUWhbK+ImH0G8Kni2AR0sdokLf/KyXRw5P6n4A9ZbgMHOuPfN/PEsYgw4eosuTAonutK0xILk/hA81A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "(Apache-2.0 WITH LLVM-exception)", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=20" + } + }, + "node_modules/@bytecodealliance/jco-node-fs-darwin-x64": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@bytecodealliance/jco-node-fs-darwin-x64/-/jco-node-fs-darwin-x64-0.3.2.tgz", + "integrity": "sha512-Fy/OjHnto7hNE5ksewVkmAMXG/uXyj+RAKFZWQFTzFkp73UyT5vuPjKq3nvx9KolUGWBG37BudEMb4ZAoD9TbQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "(Apache-2.0 WITH LLVM-exception)", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=20" + } + }, + "node_modules/@bytecodealliance/jco-node-fs-linux-arm64-gnu": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@bytecodealliance/jco-node-fs-linux-arm64-gnu/-/jco-node-fs-linux-arm64-gnu-0.3.2.tgz", + "integrity": "sha512-OafRtRu3tfOFQARfkia/LDEqSo2R3yAL1xPwzf4RcRW6JqkOY7qKWsUS5+LPVo/aFaSkMX7F7bdFGpFPmcoZJg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "(Apache-2.0 WITH LLVM-exception)", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20" + } + }, + "node_modules/@bytecodealliance/jco-node-fs-linux-arm64-musl": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@bytecodealliance/jco-node-fs-linux-arm64-musl/-/jco-node-fs-linux-arm64-musl-0.3.2.tgz", + "integrity": "sha512-JblDiwD7+Y+w0d/tjaNDX4QdGvh5lyuDc+S/jDeT7sYA1caA9yiwIjLa8PC/lm2xudqSxD+Cuy4AosXvl+qI0g==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "(Apache-2.0 WITH LLVM-exception)", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20" + } + }, + "node_modules/@bytecodealliance/jco-node-fs-linux-x64-gnu": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@bytecodealliance/jco-node-fs-linux-x64-gnu/-/jco-node-fs-linux-x64-gnu-0.3.2.tgz", + "integrity": "sha512-6FzmHoLOsa6b4X9AuFLsvlpNF66Dt4sRRftZHaT1I1pYzCWrJkkpgNJhRXxf67ZPmOwBZJT4dan/g752Rx4xRw==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "(Apache-2.0 WITH LLVM-exception)", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20" + } + }, + "node_modules/@bytecodealliance/jco-node-fs-linux-x64-musl": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@bytecodealliance/jco-node-fs-linux-x64-musl/-/jco-node-fs-linux-x64-musl-0.3.2.tgz", + "integrity": "sha512-SbAJG2PDV8YAHBESHU9sVSckOitJyvlezdF4CGP5/mOp01JnijVkLVXzGK62yVSfa5TpAybbSd1rk+v36NAW/Q==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "(Apache-2.0 WITH LLVM-exception)", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20" + } + }, + "node_modules/@bytecodealliance/jco-node-fs-win32-arm64-msvc": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@bytecodealliance/jco-node-fs-win32-arm64-msvc/-/jco-node-fs-win32-arm64-msvc-0.3.2.tgz", + "integrity": "sha512-nUWYdFysRQJGsIOCk0KAYN2smkNYiHG7rZ7m+0ZXqP+5wqWxKEjkDsORwXiBjdaWFLVww0anZ3SBxrju6P7hXQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "(Apache-2.0 WITH LLVM-exception)", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=20" + } + }, + "node_modules/@bytecodealliance/jco-node-fs-win32-x64-msvc": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@bytecodealliance/jco-node-fs-win32-x64-msvc/-/jco-node-fs-win32-x64-msvc-0.3.2.tgz", + "integrity": "sha512-RsPj2t8TvltsMWK7/Z7JcVC/IWPMi07/AJkNLiNTCuGTdT/sseqTThJJwhuz3sjFw7dJdxA+bSGT+23y/KT0fw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "(Apache-2.0 WITH LLVM-exception)", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=20" + } + }, + "node_modules/@bytecodealliance/jco-transpile": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/@bytecodealliance/jco-transpile/-/jco-transpile-0.13.0.tgz", + "integrity": "sha512-9hZ2GMqOlYP1Bf7qQ8v3sCsmkFoXGbgi0HtjHipzrgyk+9GGDzvvbehTGe0oM54rcbKJacvyjpPDn7wtpgzwYA==", + "dev": true, + "license": "(Apache-2.0 WITH LLVM-exception)", + "dependencies": { + "@bytecodealliance/preview2-shim": "^0.24.1", + "@bytecodealliance/preview3-shim": "^0.6.0", + "binaryen": "^130.0.0", + "oxc-minify": "^0.136.0" + } + }, + "node_modules/@bytecodealliance/preview2-shim": { + "version": "0.24.1", + "resolved": "https://registry.npmjs.org/@bytecodealliance/preview2-shim/-/preview2-shim-0.24.1.tgz", + "integrity": "sha512-QGZsKD5M76xBhwu3BzLWqYDEpaMX90QWrrfhkQPn2pN9t378koumtdAVH4lr25mqGCZt10YNXkWvyWkw/vJbLQ==", + "dev": true, + "license": "(Apache-2.0 WITH LLVM-exception)", + "dependencies": { + "@bytecodealliance/jco-node-fs": "0.3.2" + } + }, + "node_modules/@bytecodealliance/preview3-shim": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/@bytecodealliance/preview3-shim/-/preview3-shim-0.6.1.tgz", + "integrity": "sha512-61mEfjfgGmZhEMA0H3waawPKvYd3za9y0vJ7pmQz/9yvm4FR6Ef+cmqhnxDE7ezsM07MY1btP92ymmgsgFwxmg==", + "dev": true, + "license": "(Apache-2.0 WITH LLVM-exception)", + "dependencies": { + "@bytecodealliance/jco-node-fs": "0.3.2", + "@bytecodealliance/preview2-shim": "^0.25.0" + } + }, + "node_modules/@bytecodealliance/preview3-shim/node_modules/@bytecodealliance/preview2-shim": { + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/@bytecodealliance/preview2-shim/-/preview2-shim-0.25.0.tgz", + "integrity": "sha512-6ZSDRJ8hJc/febZepzd68z3KzLcOXyCOKtRm8LB2rgAU88xV7ykq6dMb5I4a+sBh1cuV2Yb1159gDzI1q8UsoQ==", + "dev": true, + "license": "(Apache-2.0 WITH LLVM-exception)", + "dependencies": { + "@bytecodealliance/jco-node-fs": "0.3.2" + } + }, "node_modules/@emnapi/core": { "version": "1.9.2", "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.9.2.tgz", @@ -768,166 +982,652 @@ "license": "MIT", "optional": true, "os": [ - "win32" + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.2.tgz", + "integrity": "sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@floating-ui/core": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.8.0.tgz", + "integrity": "sha512-0CIZ5itps/8x7BG8dEIhs53BvCUH2PCoogtakwRTut+Arm58sJooJ0AuZhLw2HJYIR5cMLNPBSS728sPho2khQ==", + "license": "MIT", + "dependencies": { + "@floating-ui/utils": "^0.2.12" + } + }, + "node_modules/@floating-ui/dom": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.8.0.tgz", + "integrity": "sha512-yXSrzeHZBTZadLOlfyhCkJHNeLJnHRnRInwdZ40L7ZiaAtrBwoYlsDrX3v5zB1Utk7CLfzcOVnVVWoXEky7Ceg==", + "license": "MIT", + "dependencies": { + "@floating-ui/core": "^1.8.0", + "@floating-ui/utils": "^0.2.12" + } + }, + "node_modules/@floating-ui/react-dom": { + "version": "2.1.9", + "resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.1.9.tgz", + "integrity": "sha512-JDjEFGCpImxDCA7JJKviA0M9+RtmJdj0m/NVU5IMgBK+AmZouAQQ7/+2GLH0GXXY0YMw9oXPB8hKdbPYg5QLYg==", + "license": "MIT", + "dependencies": { + "@floating-ui/dom": "^1.8.0" + }, + "peerDependencies": { + "react": ">=16.8.0", + "react-dom": ">=16.8.0" + } + }, + "node_modules/@floating-ui/utils": { + "version": "0.2.12", + "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.12.tgz", + "integrity": "sha512-HpCo8tmWzLVad5s2d19EhAz5zqrrQ6s69qd6moPMQvkOuSwDT1YgRfWSVuc4ennqrgv3OHppiOGMQ7oC13yIww==", + "license": "MIT" + }, + "node_modules/@fontsource-variable/geist": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@fontsource-variable/geist/-/geist-5.3.0.tgz", + "integrity": "sha512-j0m+vLQuG5XAYoHtGCVu0spvlGreR3EzpECUVzkFmI1mTVnAO38l/NEPDCFgZ177JxzYJCLSmTQibIiYPilGrA==", + "license": "OFL-1.1", + "funding": { + "url": "https://github.com/sponsors/ayuhito" + } + }, + "node_modules/@inlang/paraglide-js": { + "version": "2.29.3", + "resolved": "https://registry.npmjs.org/@inlang/paraglide-js/-/paraglide-js-2.29.3.tgz", + "integrity": "sha512-aI9gT7zGTpr/l8tZM7OXHrgGruZ6jcu2iIqIw8QXKOGOY4akF3u1cIK6EBsttBm+DHI0FGiwCl8xVUjz7kDZHg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inlang/recommend-sherlock": "^0.2.1", + "@inlang/sdk": "^4.0.4", + "commander": "11.1.0", + "consola": "3.4.0", + "jiti": "^2.7.0", + "json5": "2.2.3", + "jsonc-parser": "^3.3.1", + "unplugin": "^2.1.2", + "urlpattern-polyfill": "^10.0.0", + "valibot": "^1.4.2" + }, + "bin": { + "paraglide-js": "bin/run.js" + }, + "peerDependencies": { + "eslint": "^9.0.0 || ^10.0.0", + "typescript": ">=5.6", + "vite": ">=5.0.0" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + }, + "typescript": { + "optional": true + }, + "vite": { + "optional": true + } + } + }, + "node_modules/@inlang/plugin-message-format": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@inlang/plugin-message-format/-/plugin-message-format-4.6.0.tgz", + "integrity": "sha512-DK2GZvypDygLchnUaFK/RdCIm2baiRlQftOiesGNKDtjNqioqWHnnu0zg6NKNlo3kD42h5xlRCke7zEjBFzZrg==", + "dev": true, + "dependencies": { + "@inlang/sdk": "4.2.0", + "@sinclair/typebox": "^0.31.17" + } + }, + "node_modules/@inlang/recommend-sherlock": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@inlang/recommend-sherlock/-/recommend-sherlock-0.2.1.tgz", + "integrity": "sha512-ckv8HvHy/iTqaVAEKrr+gnl+p3XFNwe5D2+6w6wJk2ORV2XkcRkKOJ/XsTUJbPSiyi4PI+p+T3bqbmNx/rDUlg==", + "dev": true, + "license": "MIT", + "dependencies": { + "comment-json": "^4.2.3" + } + }, + "node_modules/@inlang/sdk": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@inlang/sdk/-/sdk-4.2.0.tgz", + "integrity": "sha512-Cmaqvn34wsxiF27318Zw2rg+017HHNJWV5MH8rfyVKVANZNpzlztxzRbFienE/gASMLD8oluYHHolIb/p6Egrw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@lix-js/sdk": "0.20.1", + "@sinclair/typebox": "^0.31.17", + "kysely": "^0.28.12", + "uuid": "^14.0.0" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@joshwooding/vite-plugin-react-docgen-typescript": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@joshwooding/vite-plugin-react-docgen-typescript/-/vite-plugin-react-docgen-typescript-0.7.0.tgz", + "integrity": "sha512-qvsTEwEFefhdirGOPnu9Wp6ChfIwy2dBCRuETU3uE+4cC+PFoxMSiiEhxk4lOluA34eARHA0OxqsEUYDqRMgeQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "glob": "^13.0.1", + "react-docgen-typescript": "^2.2.2" + }, + "peerDependencies": { + "typescript": ">= 4.3.x", + "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/remapping": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", + "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", + "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@lix-js/sdk": { + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@lix-js/sdk/-/sdk-0.20.1.tgz", + "integrity": "sha512-oscOFP8Cr1My6Wh2KVYC9+aJ1mHs+d7vnD+7PPJaA4L+Y1FR37Sm99SrFGfvUizaj/XtRi2GlDF2IOFt9iXMNQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@bytecodealliance/jco-transpile": "0.13.0", + "binaryen": "130.0.0", + "fflate": "^0.8.3" + } + }, + "node_modules/@napi-rs/wasm-runtime": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.2.4.tgz", + "integrity": "sha512-AJxoUD2/15ESHbvpcyjU274nsAPLuOtPHCk0vKJM5pj//Fg/B1FXNWjPnXTT9PymCYYiHo4zPj0ZomXBKhoy7g==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@tybys/wasm-util": "^0.10.3" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=23.5.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + }, + "peerDependencies": { + "@emnapi/core": "^1.7.1 || ^2.0.0-alpha.4", + "@emnapi/runtime": "^1.7.1 || ^2.0.0-alpha.4" + } + }, + "node_modules/@oxc-minify/binding-android-arm-eabi": { + "version": "0.136.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-android-arm-eabi/-/binding-android-arm-eabi-0.136.0.tgz", + "integrity": "sha512-gk1jzky1vLeOcK7w9Ib2RT/UooZ7O21s8YSeXCsy4tzsmguKb3Cbsv/Ra2fKhMp4mKeKCzvC1Xa41OfSBWfWdQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-minify/binding-android-arm64": { + "version": "0.136.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-android-arm64/-/binding-android-arm64-0.136.0.tgz", + "integrity": "sha512-5GIYanqud/ohXEcg2dsdn0+eSKXqclw5qlRUkvSM1sKEa4ZQ7hqOk8XPJBNPh3LXXw+Qw85B6jkmOFLKsCHp5w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-minify/binding-darwin-arm64": { + "version": "0.136.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-darwin-arm64/-/binding-darwin-arm64-0.136.0.tgz", + "integrity": "sha512-QAMpHKXWOoMCTenSZjQjVT5YmMooujlCKAf1T3PHFl2LuaA6ukQFXba0bgSLgAxRrAeX/itkwi4lzVQXtYmnRg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-minify/binding-darwin-x64": { + "version": "0.136.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-darwin-x64/-/binding-darwin-x64-0.136.0.tgz", + "integrity": "sha512-rDnoPj8hztiU8C1VNKuzujh7SgTJlgiUvUCiWQjTnVSLsABsLW9ZWd1l1Ji0VN3UW39wGpptgvahIWTrHnGH/A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-minify/binding-freebsd-x64": { + "version": "0.136.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-freebsd-x64/-/binding-freebsd-x64-0.136.0.tgz", + "integrity": "sha512-9fGSgP7uyPLCTjMx9z3AUV4UjnfOVoGTH5JzamLegPwGLJ97Gr1jht1437CRk8ZNabGmxQR6qNn3e+Tox2lswg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-minify/binding-linux-arm-gnueabihf": { + "version": "0.136.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-0.136.0.tgz", + "integrity": "sha512-k0QvZS+x6ROI4O5Ikqn9dDU2dmkEJ46Yh6baZJI/eUk/a1k1GOs9/vyXItLZrKlwYrSgdEx2BFXbKgyd1NyRPw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-minify/binding-linux-arm-musleabihf": { + "version": "0.136.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-linux-arm-musleabihf/-/binding-linux-arm-musleabihf-0.136.0.tgz", + "integrity": "sha512-iRFxUc8ubotVfuyq3e4LPGbHrjvWd1/B3499a55GueMLc1EDJ0fHzNXJiCx2eMQGfzHtHodjmvrJ2BSvSXBNhQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-minify/binding-linux-arm64-gnu": { + "version": "0.136.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-0.136.0.tgz", + "integrity": "sha512-hbKxNCXJsULrb6EyG5SumzJKuPfP8Y0UQ/TElRgXVUhyyPf6cBPlF8HMq+MAylF98ACBzV8jBp2Mm62lJyTo+w==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-minify/binding-linux-arm64-musl": { + "version": "0.136.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-linux-arm64-musl/-/binding-linux-arm64-musl-0.136.0.tgz", + "integrity": "sha512-T+u/CGKW0UXemJeVux4ix6rK+ug3bQCUEbu5hFlX9K61KQNd44rOcrM15mDK99L7USaXwmiwHeIkEDvmmyDMSA==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-minify/binding-linux-ppc64-gnu": { + "version": "0.136.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-0.136.0.tgz", + "integrity": "sha512-WNPTN2F448tb49BoqjV9IMRzZWa0WB8GHzrB+bnxKQPOyzz07T6rmDKrr4Hjl81ADGjDYSsr1fgXcjyLQFdMdw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-minify/binding-linux-riscv64-gnu": { + "version": "0.136.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-0.136.0.tgz", + "integrity": "sha512-MvcCfu8OeabrmNN9wqhh8Gqizg68RQ3iOvXBJmlLMy5p1PC6az9bAwqOk98lsCmKI4I5LpULekOlfxRYh3o5Kw==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-minify/binding-linux-riscv64-musl": { + "version": "0.136.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-0.136.0.tgz", + "integrity": "sha512-rwJXFUFFA0egAULtOOgfW8YhhLhtWrr2qFxftvZ7/U6Xtxiev8i+eCwSNW1RpHiX74QMsJVpRE3ykoefqb1MtQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-minify/binding-linux-s390x-gnu": { + "version": "0.136.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-0.136.0.tgz", + "integrity": "sha512-qizAxHmj7VHm5/D5qiIlvzxAS2tlmadDOJ5XFI7zx/wfnk/+fdk5iVaHOv+C4tDE/4wLQyMoBYVIs6R1LeN91w==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-minify/binding-linux-x64-gnu": { + "version": "0.136.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-linux-x64-gnu/-/binding-linux-x64-gnu-0.136.0.tgz", + "integrity": "sha512-gcyLAad0UblkEhGjVfx5Mwq63OSx8r04IbcfwzpZYpHisO/vioMsrs4GkDsQZ2Ejc8cdUk6YMIrf9FwNBzh+Dw==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" ], "engines": { - "node": ">=18" + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/@esbuild/win32-x64": { - "version": "0.28.2", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.2.tgz", - "integrity": "sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g==", + "node_modules/@oxc-minify/binding-linux-x64-musl": { + "version": "0.136.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-linux-x64-musl/-/binding-linux-x64-musl-0.136.0.tgz", + "integrity": "sha512-QAK6kwBjljX6luYzeppVdRP3gTaFNFfp9iS/V0cCvU43wUZay5xFXBgmzBHYrzZV2MhzURNnXfEZRo9poAxyvA==", "cpu": [ "x64" ], "dev": true, + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ - "win32" + "linux" ], "engines": { - "node": ">=18" - } - }, - "node_modules/@floating-ui/core": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.8.0.tgz", - "integrity": "sha512-0CIZ5itps/8x7BG8dEIhs53BvCUH2PCoogtakwRTut+Arm58sJooJ0AuZhLw2HJYIR5cMLNPBSS728sPho2khQ==", - "license": "MIT", - "dependencies": { - "@floating-ui/utils": "^0.2.12" + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/@floating-ui/dom": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.8.0.tgz", - "integrity": "sha512-yXSrzeHZBTZadLOlfyhCkJHNeLJnHRnRInwdZ40L7ZiaAtrBwoYlsDrX3v5zB1Utk7CLfzcOVnVVWoXEky7Ceg==", + "node_modules/@oxc-minify/binding-openharmony-arm64": { + "version": "0.136.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-openharmony-arm64/-/binding-openharmony-arm64-0.136.0.tgz", + "integrity": "sha512-nIGxkTOnN9GwslmooxbZ3Ti2RgbX9QLHy0X9uO0pslOT+4dsNVUawBU/6r4M5cWM+ZdRD2tOF4V+n0l8tS59nQ==", + "cpu": [ + "arm64" + ], + "dev": true, "license": "MIT", - "dependencies": { - "@floating-ui/core": "^1.8.0", - "@floating-ui/utils": "^0.2.12" + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/@floating-ui/react-dom": { - "version": "2.1.9", - "resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.1.9.tgz", - "integrity": "sha512-JDjEFGCpImxDCA7JJKviA0M9+RtmJdj0m/NVU5IMgBK+AmZouAQQ7/+2GLH0GXXY0YMw9oXPB8hKdbPYg5QLYg==", + "node_modules/@oxc-minify/binding-wasm32-wasi": { + "version": "0.136.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-wasm32-wasi/-/binding-wasm32-wasi-0.136.0.tgz", + "integrity": "sha512-YB3G8AHT6PpDS8/DfjlJrQjywj+/6gCkNBcAJdYzcYbQRIZE6SaTNowiGuZPR1m1jOl1WjcjefniKSmVxzhvRA==", + "cpu": [ + "wasm32" + ], + "dev": true, "license": "MIT", + "optional": true, "dependencies": { - "@floating-ui/dom": "^1.8.0" + "@emnapi/core": "1.11.1", + "@emnapi/runtime": "1.11.1", + "@napi-rs/wasm-runtime": "^1.1.5" }, - "peerDependencies": { - "react": ">=16.8.0", - "react-dom": ">=16.8.0" - } - }, - "node_modules/@floating-ui/utils": { - "version": "0.2.12", - "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.12.tgz", - "integrity": "sha512-HpCo8tmWzLVad5s2d19EhAz5zqrrQ6s69qd6moPMQvkOuSwDT1YgRfWSVuc4ennqrgv3OHppiOGMQ7oC13yIww==", - "license": "MIT" - }, - "node_modules/@fontsource-variable/geist": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/@fontsource-variable/geist/-/geist-5.3.0.tgz", - "integrity": "sha512-j0m+vLQuG5XAYoHtGCVu0spvlGreR3EzpECUVzkFmI1mTVnAO38l/NEPDCFgZ177JxzYJCLSmTQibIiYPilGrA==", - "license": "OFL-1.1", - "funding": { - "url": "https://github.com/sponsors/ayuhito" + "engines": { + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/@joshwooding/vite-plugin-react-docgen-typescript": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@joshwooding/vite-plugin-react-docgen-typescript/-/vite-plugin-react-docgen-typescript-0.7.0.tgz", - "integrity": "sha512-qvsTEwEFefhdirGOPnu9Wp6ChfIwy2dBCRuETU3uE+4cC+PFoxMSiiEhxk4lOluA34eARHA0OxqsEUYDqRMgeQ==", + "node_modules/@oxc-minify/binding-wasm32-wasi/node_modules/@emnapi/core": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.11.1.tgz", + "integrity": "sha512-RSvbQmHzdKzNsLYa/wHrbc3KN4sYLKAdPZxqiM2HATqv/SBk2/ENSHpvXGaLOMcsAyz0poEGqkmmKYG3OWiJEQ==", "dev": true, "license": "MIT", + "optional": true, "dependencies": { - "glob": "^13.0.1", - "react-docgen-typescript": "^2.2.2" - }, - "peerDependencies": { - "typescript": ">= 4.3.x", - "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } + "@emnapi/wasi-threads": "1.2.2", + "tslib": "^2.4.0" } }, - "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.13", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", - "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", + "node_modules/@oxc-minify/binding-wasm32-wasi/node_modules/@emnapi/runtime": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.1.tgz", + "integrity": "sha512-vgj7R3y3Wgx24IQaGPA/R6YFXLHVMOZ0uVEyIQPaWs+rd1AzfEMXlAC22FYwO1XkKR6NPsq7mUandH8oIRdZFw==", "dev": true, "license": "MIT", + "optional": true, "dependencies": { - "@jridgewell/sourcemap-codec": "^1.5.0", - "@jridgewell/trace-mapping": "^0.3.24" + "tslib": "^2.4.0" } }, - "node_modules/@jridgewell/remapping": { - "version": "2.3.5", - "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", - "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", + "node_modules/@oxc-minify/binding-wasm32-wasi/node_modules/@emnapi/wasi-threads": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.2.tgz", + "integrity": "sha512-c95qOXkHdydNKhscBTebqEC1CVAZpyqOfVfBzQ1qgzyl3gfeldUjIggDbIZgDKsHLgnsM+igH7TJ/eAasaVuMA==", "dev": true, "license": "MIT", + "optional": true, "dependencies": { - "@jridgewell/gen-mapping": "^0.3.5", - "@jridgewell/trace-mapping": "^0.3.24" + "tslib": "^2.4.0" } }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", - "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "node_modules/@oxc-minify/binding-win32-arm64-msvc": { + "version": "0.136.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-0.136.0.tgz", + "integrity": "sha512-UVRH3BlNc2rmla+sbSd5xTF/u+esCqZS6VSWPolZybcBh3TlVe1Sf5MOuHQWUaFoyv5uFOvee4hOfS/14nPvZw==", + "cpu": [ + "arm64" + ], "dev": true, "license": "MIT", + "optional": true, + "os": [ + "win32" + ], "engines": { - "node": ">=6.0.0" + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", - "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", - "dev": true, - "license": "MIT" - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.31", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", - "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "node_modules/@oxc-minify/binding-win32-ia32-msvc": { + "version": "0.136.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-0.136.0.tgz", + "integrity": "sha512-zFGkUd82jci0E+isc2O36lVmmXVUDXyEMN2RYIyez+MBNqhdjPLIGx62FCsrJtLKeuiPf/8XkFv977aUtndUng==", + "cpu": [ + "ia32" + ], "dev": true, "license": "MIT", - "dependencies": { - "@jridgewell/resolve-uri": "^3.1.0", - "@jridgewell/sourcemap-codec": "^1.4.14" + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/@napi-rs/wasm-runtime": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.2.4.tgz", - "integrity": "sha512-AJxoUD2/15ESHbvpcyjU274nsAPLuOtPHCk0vKJM5pj//Fg/B1FXNWjPnXTT9PymCYYiHo4zPj0ZomXBKhoy7g==", + "node_modules/@oxc-minify/binding-win32-x64-msvc": { + "version": "0.136.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-win32-x64-msvc/-/binding-win32-x64-msvc-0.136.0.tgz", + "integrity": "sha512-VHgPwd5xibC9UYxBeq7nURTjY+wxhdumllij6JaCIUVfD9IRcrA66SVlJ5fPNoUXcRp8ZXhJfoIZwVz9wAEGJw==", + "cpu": [ + "x64" + ], "dev": true, "license": "MIT", "optional": true, - "dependencies": { - "@tybys/wasm-util": "^0.10.3" - }, + "os": [ + "win32" + ], "engines": { - "node": "^20.19.0 || ^22.13.0 || >=23.5.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/Brooooooklyn" - }, - "peerDependencies": { - "@emnapi/core": "^1.7.1 || ^2.0.0-alpha.4", - "@emnapi/runtime": "^1.7.1 || ^2.0.0-alpha.4" + "node": "^20.19.0 || >=22.12.0" } }, "node_modules/@oxc-parser/binding-android-arm-eabi": { @@ -3383,6 +4083,13 @@ } } }, + "node_modules/@sinclair/typebox": { + "version": "0.31.30", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.31.30.tgz", + "integrity": "sha512-MGsM7bVmHg3sUKCphlu3SGQ+T+5JTbygZWYArfKQCW5anJeACHeqLhcnf+R7XlCWZ+QR3C8JTBx3kCKJTN69ow==", + "dev": true, + "license": "MIT" + }, "node_modules/@storybook/builder-vite": { "version": "10.6.0", "resolved": "https://registry.npmjs.org/@storybook/builder-vite/-/builder-vite-10.6.0.tgz", @@ -5185,6 +5892,19 @@ "dev": true, "license": "MIT" }, + "node_modules/acorn": { + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.19.0.tgz", + "integrity": "sha512-oJlA3XiRm7Cyk6qFD2Jn8ak9B7jSy0qy00ADO3+8dpT0LSjFihQYv4C02LFCSYJV3Q37xYwwRy5m+IpIiUzqWw==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", @@ -5230,6 +5950,13 @@ "dequal": "^2.0.3" } }, + "node_modules/array-timsort": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-timsort/-/array-timsort-1.0.3.tgz", + "integrity": "sha512-/+3GRL7dDAGEfM6TseQk/U+mi18TU2Ms9I3UlLdUMhz2hbvGNTKdj9xniwXfUqgYhHxRx0+8UnKkvlNwVU+cWQ==", + "dev": true, + "license": "MIT" + }, "node_modules/assertion-error": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", @@ -5276,6 +6003,24 @@ "node": ">=6.0.0" } }, + "node_modules/binaryen": { + "version": "130.0.0", + "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-130.0.0.tgz", + "integrity": "sha512-XDrb+zql0RbFPKgj7MuH9zOc78R3Fa/P/VSGnnpdwYsvNZPWjcMYMdAkKCOQEL2A7yqgjSMTDRFp6gfSDW+/QQ==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "wasm-as": "bin/wasm-as", + "wasm-ctor-eval": "bin/wasm-ctor-eval", + "wasm-dis": "bin/wasm-dis", + "wasm-merge": "bin/wasm-merge", + "wasm-metadce": "bin/wasm-metadce", + "wasm-opt": "bin/wasm-opt", + "wasm-reduce": "bin/wasm-reduce", + "wasm-shell": "bin/wasm-shell", + "wasm2js": "bin/wasm2js" + } + }, "node_modules/brace-expansion": { "version": "5.0.12", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.12.tgz", @@ -5418,6 +6163,40 @@ "node": ">=6" } }, + "node_modules/commander": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-11.1.0.tgz", + "integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=16" + } + }, + "node_modules/comment-json": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/comment-json/-/comment-json-4.6.2.tgz", + "integrity": "sha512-R2rze/hDX30uul4NZoIZ76ImSJLFxn/1/ZxtKC1L77y2X1k+yYu1joKbAtMA2Fg3hZrTOiw0I5mwVMo0cf250w==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-timsort": "^1.0.3", + "esprima": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/consola": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/consola/-/consola-3.4.0.tgz", + "integrity": "sha512-EiPU8G6dQG0GFHNR8ljnZFki/8a+cQwEQ+7wpxdChl02Q8HXlwEZWD5lqAF8vC2sEC3Tehr8hy7vErz88LHyUA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.18.0 || >=16.10.0" + } + }, "node_modules/convert-source-map": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", @@ -5737,6 +6516,13 @@ } } }, + "node_modules/fflate": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.3.tgz", + "integrity": "sha512-tbZNuJrLwGUp3zshBtdy4W+ORxZuIh8a5ilyIEQDC5rY1f3U20JMry0Ll3WBzU58EZKsEuJFXhb5gwv8CsPvgA==", + "dev": true, + "license": "MIT" + }, "node_modules/framer-motion": { "version": "13.4.4", "resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-13.4.4.tgz", @@ -6020,6 +6806,16 @@ "dev": true, "license": "MIT" }, + "node_modules/kysely": { + "version": "0.28.19", + "resolved": "https://registry.npmjs.org/kysely/-/kysely-0.28.19.tgz", + "integrity": "sha512-sXoKWuQjtorwxDLiws0ZSPGGne/hs+fGHIII7vXquSBFgHwLXgFIHN9tTv3kNdVkJ5d3xtXC84GjjWMYLqdFWg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20.0.0" + } + }, "node_modules/lightningcss": { "version": "1.32.0", "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.32.0.tgz", @@ -6491,6 +7287,41 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/oxc-minify": { + "version": "0.136.0", + "resolved": "https://registry.npmjs.org/oxc-minify/-/oxc-minify-0.136.0.tgz", + "integrity": "sha512-u9UvPFTYVwQ/i1kpp/c20S/SbvLaLV0Ngzyhgi0YV4B1SlxM7RgnnePl4vY9N3Z9sTRcozL1MRStI3PlUN9RFA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/sponsors/Boshen" + }, + "optionalDependencies": { + "@oxc-minify/binding-android-arm-eabi": "0.136.0", + "@oxc-minify/binding-android-arm64": "0.136.0", + "@oxc-minify/binding-darwin-arm64": "0.136.0", + "@oxc-minify/binding-darwin-x64": "0.136.0", + "@oxc-minify/binding-freebsd-x64": "0.136.0", + "@oxc-minify/binding-linux-arm-gnueabihf": "0.136.0", + "@oxc-minify/binding-linux-arm-musleabihf": "0.136.0", + "@oxc-minify/binding-linux-arm64-gnu": "0.136.0", + "@oxc-minify/binding-linux-arm64-musl": "0.136.0", + "@oxc-minify/binding-linux-ppc64-gnu": "0.136.0", + "@oxc-minify/binding-linux-riscv64-gnu": "0.136.0", + "@oxc-minify/binding-linux-riscv64-musl": "0.136.0", + "@oxc-minify/binding-linux-s390x-gnu": "0.136.0", + "@oxc-minify/binding-linux-x64-gnu": "0.136.0", + "@oxc-minify/binding-linux-x64-musl": "0.136.0", + "@oxc-minify/binding-openharmony-arm64": "0.136.0", + "@oxc-minify/binding-wasm32-wasi": "0.136.0", + "@oxc-minify/binding-win32-arm64-msvc": "0.136.0", + "@oxc-minify/binding-win32-ia32-msvc": "0.136.0", + "@oxc-minify/binding-win32-x64-msvc": "0.136.0" + } + }, "node_modules/oxc-parser": { "version": "0.127.0", "resolved": "https://registry.npmjs.org/oxc-parser/-/oxc-parser-0.127.0.tgz", @@ -7593,6 +8424,22 @@ "dev": true, "license": "MIT" }, + "node_modules/unplugin": { + "version": "2.3.11", + "resolved": "https://registry.npmjs.org/unplugin/-/unplugin-2.3.11.tgz", + "integrity": "sha512-5uKD0nqiYVzlmCRs01Fhs2BdkEgBS3SAVP6ndrBsuK42iC2+JHyxM05Rm9G8+5mkmRtzMZGY8Ct5+mliZxU/Ww==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/remapping": "^2.3.5", + "acorn": "^8.15.0", + "picomatch": "^4.0.3", + "webpack-virtual-modules": "^0.6.2" + }, + "engines": { + "node": ">=18.12.0" + } + }, "node_modules/update-browserslist-db": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.3.3.tgz", @@ -7624,6 +8471,13 @@ "browserslist": ">= 4.21.0" } }, + "node_modules/urlpattern-polyfill": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/urlpattern-polyfill/-/urlpattern-polyfill-10.1.0.tgz", + "integrity": "sha512-IGjKp/o0NL3Bso1PymYURCJxMPNAf/ILOpendP9f5B6e1rTJgdgiOvgfoT8VxCAdY+Wisb9uhGaJJf3yZ2V9nw==", + "dev": true, + "license": "MIT" + }, "node_modules/use-callback-ref": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/use-callback-ref/-/use-callback-ref-1.3.3.tgz", @@ -7676,6 +8530,35 @@ "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, + "node_modules/uuid": { + "version": "14.0.3", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-14.0.3.tgz", + "integrity": "sha512-Sc5u1VVln93y1Xnz4R+CunOZc7R9LUcTmhj7Rc7Eg3HVcf7rVn2FOoa812fe0W8p3jD7xeoGSYbfqCGGH2B6xw==", + "dev": true, + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "bin": { + "uuid": "dist-node/bin/uuid" + } + }, + "node_modules/valibot": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/valibot/-/valibot-1.5.0.tgz", + "integrity": "sha512-nil6AkP2TChWL43Z5uJ6GTxX01CUA+g8LWUM+N/rB9NBbkUMaUsi9PUNzlUPgoKASgmx9f7eGOYpJ04/fSa6FQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "typescript": ">=5" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, "node_modules/verkit": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/verkit/-/verkit-0.4.1.tgz", @@ -8028,6 +8911,13 @@ "url": "https://opencollective.com/parcel" } }, + "node_modules/webpack-virtual-modules": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/webpack-virtual-modules/-/webpack-virtual-modules-0.6.2.tgz", + "integrity": "sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ==", + "dev": true, + "license": "MIT" + }, "node_modules/ws": { "version": "8.21.3", "resolved": "https://registry.npmjs.org/ws/-/ws-8.21.3.tgz", diff --git a/packages/stream/package.json b/packages/stream/package.json index 1c65d44..d87f011 100644 --- a/packages/stream/package.json +++ b/packages/stream/package.json @@ -29,6 +29,7 @@ "build:lib": "tsdown && cp wasm/punktfunk_client_web.wasm dist/", "build": "npm run build:wasm && npm run build:lib", "check": "tsc --noEmit", + "pretest": "node ../../scripts/l10n-messages.mjs", "test": "node --experimental-transform-types --disable-warning=ExperimentalWarning --test 'src/**/*.test.ts'" }, "dependencies": { diff --git a/scripts/l10n-messages.mjs b/scripts/l10n-messages.mjs new file mode 100644 index 0000000..cd8fc82 --- /dev/null +++ b/scripts/l10n-messages.mjs @@ -0,0 +1,69 @@ +// The page's messages: the pinned monorepo's `l10n/` crate, found through Cargo's checkout, copied +// where Paraglide reads them. +// +// node scripts/l10n-messages.mjs +// +// Copies `messages/{common,client,browser,host}/.json` for the source language and every +// shipped one into `apps/web/l10n//` (git-ignored), and writes the same locale list into +// `apps/web/project.inlang/settings.json`. The shipped list has one source: `locales.json`. A +// language the monorepo has not shipped is a draft and is not copied. + +import { spawnSync } from "node:child_process"; +import { copyFileSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs"; +import { dirname, join, resolve } from "node:path"; +import { fileURLToPath } from "node:url"; + +const root = resolve(dirname(fileURLToPath(import.meta.url)), ".."); +const stream = join(root, "packages", "stream"); +const web = join(root, "apps", "web"); +const PARTS = ["common", "client", "browser", "host"]; + +function cargo(...args) { + const run = spawnSync("cargo", args, { cwd: stream, encoding: "utf8", maxBuffer: 1 << 28 }); + if (run.status !== 0) { + throw new Error(`cargo ${args[0]} failed${run.error ? `: ${run.error.message}` : `\n${run.stderr}`}`); + } + return run.stdout; +} + +/** `pf-l10n`'s directory in the checkout the stream package's lock resolves. */ +function l10nDir() { + const metadata = () => JSON.parse(cargo("metadata", "--manifest-path", join(stream, "Cargo.toml"), "--format-version", "1", "--offline")); + let meta; + try { + meta = metadata(); + } catch { + // The checkout is not in Cargo's cache yet. + cargo("fetch", "--manifest-path", join(stream, "Cargo.toml"), "--locked"); + meta = metadata(); + } + const pkg = meta.packages.find((p) => p.name === "pf-l10n"); + if (!pkg) throw new Error("pf-l10n is not in packages/stream's dependency graph"); + return dirname(pkg.manifest_path); +} + +const read = (path) => JSON.parse(readFileSync(path, "utf8")); +const crate = l10nDir(); +const { source, shipped } = read(join(crate, "locales.json")); +const locales = [...new Set([source, ...shipped])]; + +rmSync(join(web, "l10n"), { recursive: true, force: true }); +for (const part of PARTS) { + mkdirSync(join(web, "l10n", part), { recursive: true }); + for (const locale of locales) { + try { + copyFileSync(join(crate, "messages", part, `${locale}.json`), join(web, "l10n", part, `${locale}.json`)); + } catch (e) { + // A part may lack a shipped language; it reads the source's text. The source itself may not be absent. + if (e.code !== "ENOENT" || locale === source) throw e; + } + } +} + +// Only the two lines that follow the monorepo; the rest of the file is hand-written. +const settingsPath = join(web, "project.inlang", "settings.json"); +const settings = readFileSync(settingsPath, "utf8") + .replace(/"baseLocale": "[^"]*"/, `"baseLocale": ${JSON.stringify(source)}`) + .replace(/"locales": \[[^\]]*\]/, `"locales": ${JSON.stringify(locales).replaceAll(",", ", ")}`); +writeFileSync(settingsPath, settings); +console.log(`l10n: ${locales.join(", ")} from ${crate}`); From 5c91de86c42fa03b32ef1a2690ff27a1914a953b Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Fri, 6 Nov 2026 22:53:00 +0100 Subject: [PATCH 03/13] feat(stream): word the engine's sentences from installed messages The engine and its helpers said their sentences in English. They read the monorepo's messages through one hook, setWords, which the page fills, so the library carries no Paraglide and no copy of the text. A message nobody installed reads as its key. A 429 from the page's server is a TooMany error instead of a sentence compared by its text. A seat line, an API refusal and a launch verdict that arrive with a message id read in the page's language; an id this build lacks reads as the host's English. --- apps/web/src/app.ts | 6 +- packages/stream/README.md | 5 ++ packages/stream/src/access.test.ts | 7 +- packages/stream/src/access.ts | 72 +++++++++++----- packages/stream/src/emscripten.d.ts | 5 +- packages/stream/src/engine.test.ts | 7 +- packages/stream/src/engine.ts | 52 ++++++------ packages/stream/src/game-end.test.ts | 3 + packages/stream/src/game-end.ts | 14 ++-- packages/stream/src/host.ts | 18 ++-- packages/stream/src/index.ts | 3 +- packages/stream/src/pass.ts | 11 ++- packages/stream/src/pf-connect.test.ts | 9 +- packages/stream/src/pf-connect.ts | 25 +++--- packages/stream/src/profiles.test.ts | 12 +++ packages/stream/src/profiles.ts | 32 +++++--- packages/stream/src/words.test.ts | 29 +++++++ packages/stream/src/words.testing.ts | 40 +++++++++ packages/stream/src/words.ts | 109 +++++++++++++++++++++++++ 19 files changed, 358 insertions(+), 101 deletions(-) create mode 100644 packages/stream/src/words.test.ts create mode 100644 packages/stream/src/words.testing.ts create mode 100644 packages/stream/src/words.ts diff --git a/apps/web/src/app.ts b/apps/web/src/app.ts index 78d529c..3eab219 100644 --- a/apps/web/src/app.ts +++ b/apps/web/src/app.ts @@ -40,12 +40,12 @@ import { type Settings, settings, statusOf, - TOO_MANY, VersionSkew, wakeFailed, wakingLine, } from "@punktfunk/stream"; import { type Configured, readConfig, type ServerConfig } from "./config.ts"; +import { m } from "./paraglide/messages.js"; import { ConsoleUi } from "./ui/console.ts"; import { noop, WebShell } from "./ui/shell.tsx"; import type { HostCard, HostTools, ProfileCard, Screen, Tab, Ui } from "./ui/types.ts"; @@ -263,7 +263,7 @@ class App { // The server turned its list away: say so, and ask again on a later redraw of the hosts. if (server.wait) { this.configAgainAt = Date.now() + server.wait * 1000; - ui.notify(sentence(TOO_MANY), "error"); + ui.notify(m.browser_too_many(), "error"); } this.applyPrefs(); this.watchSize(); @@ -705,7 +705,7 @@ class App { try { const r = await serverFetch()(url, { method: "POST" }); if (r.status === 403 || r.status === 429) { - const why = r.status === 429 ? sentence(TOO_MANY) : `Only a browser paired with ${this.nameOf(origin)} can wake it from this page.`; + const why = r.status === 429 ? m.browser_too_many() : `Only a browser paired with ${this.nameOf(origin)} can wake it from this page.`; this.ui.notify(why, "error"); return false; } diff --git a/packages/stream/README.md b/packages/stream/README.md index 0cac6a9..3c8db64 100644 --- a/packages/stream/README.md +++ b/packages/stream/README.md @@ -23,6 +23,11 @@ await engine.connect("192.168.1.25"); The state carries facts, never wording, so any interface can sit on it. What each fact means and what a person can do about it is documented on `EngineState`. +The few sentences the engine does say are Punktfunk's shared messages, which this library does not +carry: install the page's own with `setWords(messages, host?)` before the first connect, or a message +reads as its key. `host` looks up a message the host names by id, such as a seat line or a launch +verdict. `apps/web/src/words.ts` installs the compiled Paraglide messages. + ## Install ```ini diff --git a/packages/stream/src/access.test.ts b/packages/stream/src/access.test.ts index 850a58f..14596e1 100644 --- a/packages/stream/src/access.test.ts +++ b/packages/stream/src/access.test.ts @@ -3,6 +3,9 @@ import { test } from "node:test"; import assert from "node:assert/strict"; import { chipText, formatRemaining, presetLabel, updateNotice } from "./access.ts"; +import { useEnglish } from "./words.testing.ts"; + +useEnglish(); test("labels derive from the mask", () => { assert.equal(presetLabel(0x7f), "Full control"); @@ -17,10 +20,11 @@ test("a full permanent session wears no chip", () => { assert.equal(chipText(0x7f, null), undefined); assert.equal(chipText(0x01, null), "Controller only"); assert.equal(chipText(0x7f, 2 * 3600 - 120), "Full control · ends in 1 h 58 m"); + assert.equal(chipText(0x7f, 30), "Full control · ends in under 1 m"); }); test("remaining time is whole minutes", () => { - assert.equal(formatRemaining(59), "under 1 m"); + assert.equal(formatRemaining(59), undefined, "a whole message says it, not a unit"); assert.equal(formatRemaining(5 * 60), "5 m"); assert.equal(formatRemaining(3600), "1 h"); assert.equal(formatRemaining(3600 + 120), "1 h 2 m"); @@ -29,5 +33,6 @@ test("remaining time is whole minutes", () => { test("a change names the new level, a warning the time left", () => { assert.equal(updateNotice(0x7f, 0x01, null), "Access is now Controller only"); assert.equal(updateNotice(0x7f, 0x7f, 5 * 60), "Access ends in 5 m"); + assert.equal(updateNotice(0x7f, 0x7f, 30), "Access ends in under a minute"); assert.equal(updateNotice(0x7f, 0x7f, null), undefined); }); diff --git a/packages/stream/src/access.ts b/packages/stream/src/access.ts index 7ed1525..006d8fd 100644 --- a/packages/stream/src/access.ts +++ b/packages/stream/src/access.ts @@ -1,8 +1,9 @@ // This device's access to the host, as the chip and the notices say it. // -// The words are the native clients' (`pf-client-core`'s `access.rs`), copied as Apple and -// Android copy them: the preset is derived from the grant mask, never stored, and a full -// permanent session wears no chip. +// The preset is derived from the grant mask, never stored, and a full permanent session wears +// no chip. The words are the shared `grant_*` messages, as every native client says them. + +import { words } from "./words.ts"; const GRANT_GAMEPAD = 1 << 0; /** Every grant this build knows. Bits a newer host adds are dropped before labelling. */ @@ -10,35 +11,66 @@ const GRANT_ALL = 0x7f; /** "Full control" as stored before the power grant existed. */ const GRANT_ALL_PRE_POWER = 0x3f; +type Preset = "full" | "controller" | "view" | "custom"; + /** The preset a grant mask reads as. */ -export function presetLabel(grants: number): string { +function presetOf(grants: number): Preset { const mask = (grants === GRANT_ALL_PRE_POWER ? GRANT_ALL : grants) & GRANT_ALL; - if (mask === GRANT_ALL) return "Full control"; - if (mask === GRANT_GAMEPAD) return "Controller only"; - if (mask === 0) return "View only"; - return "Custom"; + if (mask === GRANT_ALL) return "full"; + if (mask === GRANT_GAMEPAD) return "controller"; + if (mask === 0) return "view"; + return "custom"; +} + +/** The preset a grant mask reads as, by name. */ +export function presetLabel(grants: number): string { + switch (presetOf(grants)) { + case "full": + return words.grant_level_full(); + case "controller": + return words.grant_level_controller(); + case "view": + return words.grant_level_view(); + case "custom": + return words.grant_level_custom(); + } } -/** Whole minutes: the wire carries whole seconds, so a seconds countdown would overclaim. */ -export function formatRemaining(secs: number): string { +/** Whole minutes: the wire carries whole seconds, so a seconds countdown would overclaim. + * `undefined` under a minute: each caller has a whole message for that. */ +export function formatRemaining(secs: number): string | undefined { const mins = Math.floor(Math.max(0, secs) / 60); - const h = Math.floor(mins / 60); - const m = mins % 60; - if (!h && !m) return "under 1 m"; - if (!h) return `${m} m`; - return m ? `${h} h ${m} m` : `${h} h`; + const hours = Math.floor(mins / 60); + const minutes = mins % 60; + if (!hours && !minutes) return undefined; + if (!hours) return words.grant_remaining_minutes({ minutes }); + return minutes ? words.grant_remaining_hours_minutes({ hours, minutes }) : words.grant_remaining_hours({ hours }); } /** The chip (`Controller only · ends in 1 h 58 m`); `undefined` for full, permanent access. * `secsLeft` is `null` for permanent. */ export function chipText(grants: number, secsLeft: number | null): string | undefined { - const label = presetLabel(grants); - if (label === "Full control" && secsLeft === null) return undefined; - return secsLeft === null ? label : `${label} · ends in ${formatRemaining(secsLeft)}`; + const level = presetLabel(grants); + if (secsLeft === null) return presetOf(grants) === "full" ? undefined : level; + const left = formatRemaining(secsLeft); + return `${level} · ${left ? words.grant_chip_ends({ time: left }) : words.grant_chip_ends_soon()}`; } /** What a mid-session change says: a new level by name, else the host's T−5 / T−1 warning. */ export function updateNotice(prevGrants: number, grants: number, secsLeft: number | null): string | undefined { - if (grants !== prevGrants) return `Access is now ${presetLabel(grants)}`; - return secsLeft !== null && secsLeft > 0 ? `Access ends in ${formatRemaining(secsLeft)}` : undefined; + if (grants !== prevGrants) { + switch (presetOf(grants)) { + case "full": + return words.grant_now_full(); + case "controller": + return words.grant_now_controller(); + case "view": + return words.grant_now_view(); + case "custom": + return words.grant_now_custom(); + } + } + if (secsLeft === null || secsLeft <= 0) return undefined; + const left = formatRemaining(secsLeft); + return left ? words.grant_ends_in({ time: left }) : words.grant_ends_soon(); } diff --git a/packages/stream/src/emscripten.d.ts b/packages/stream/src/emscripten.d.ts index 82f93c9..01ea231 100644 --- a/packages/stream/src/emscripten.d.ts +++ b/packages/stream/src/emscripten.d.ts @@ -182,8 +182,9 @@ export interface PunktfunkModule { /** The host's `Redirect`: dial `port` on the same address, pinning `certHash`, and say `Hello` * there. */ __pfOnRedirect?: (port: number, certHash: string) => void; - /** The host's sentence for a launch that did not give the player their game. */ - __pfOnLaunchNotice?: (text: string) => void; + /** The host's verdict on a launch that did not give the player their game: JSON, see + * `launchNotice`. */ + __pfOnLaunchNotice?: (verdict: string) => void; /** Datagrams have landed in the ring: pump the session now rather than at the next frame. */ __pfOnData?: () => void; /** A host pointer bitmap: straight-alpha RGBA, copied out of wasm memory. */ diff --git a/packages/stream/src/engine.test.ts b/packages/stream/src/engine.test.ts index 06025af..8b3b698 100644 --- a/packages/stream/src/engine.test.ts +++ b/packages/stream/src/engine.test.ts @@ -6,6 +6,9 @@ import { test, type TestContext } from "node:test"; import assert from "node:assert/strict"; +import { useEnglish } from "./words.testing.ts"; + +useEnglish(); // The engine schedules its frame loop on construction; nothing here runs it. globalThis.requestAnimationFrame = () => 0; @@ -272,7 +275,7 @@ test("a codec this browser can't decode gives way to another on offer, once each const live = engine.current as import("./engine.ts").EngineState; assert.equal( live.kind === "streaming" && live.stats.launchNotice, - "This browser can't decode HEVC, so the stream uses H.264, ignoring the Video codec setting.", + "This browser can't decode HEVC, so the stream uses H.264, ignoring the Video codec setting", ); // H.264 fails too: nothing is left, and HEVC is not offered again. @@ -296,7 +299,7 @@ test("only a 401 at sign-in reads as a forgotten pairing", async () => { (engine as unknown as { checkHost(o: string, fp: string, d: unknown): void }).checkHost(ORIGIN, "cd".repeat(32), device); await new Promise((r) => setTimeout(r, 20)); assert.equal(engine.current.kind, kind, `status ${status}`); - if (status === 429) assert.match((engine.current as { message: string }).message, /too many requests/); + if (status === 429) assert.match((engine.current as { message: string }).message, /too many requests/i); if (status === 502) { const host = (engine.current as { host: { info(): Promise } }).host; await assert.rejects(host.info(), (e: Error) => /couldn't sign in/.test(e.message) && !/pair/.test(e.message)); diff --git a/packages/stream/src/engine.ts b/packages/stream/src/engine.ts index eac575f..4d90d3d 100644 --- a/packages/stream/src/engine.ts +++ b/packages/stream/src/engine.ts @@ -31,7 +31,8 @@ import { type TunnelFetch, tunnelFetch } from "./tunnel.ts"; import { type Feed, wasmFeed } from "./carrier/feed.ts"; import { WtCarrier } from "./carrier/wt.ts"; import { bridgeUrl, WsCarrier } from "./carrier/ws.ts"; -import { passFor, TOO_MANY } from "./pass.ts"; +import { passFor, TooMany } from "./pass.ts"; +import { launchNotice, words } from "./words.ts"; export type { AudioSnapshot, AudioState } from "./audio.ts"; export type { MicState } from "./mic.ts"; @@ -49,11 +50,6 @@ const CLOSE = { QUIT: 0x51, PAIR_DENIED: 0x64, ACCESS_EXPIRED: 0x69, HOST_POWER: const PLACEMENT_REFUSED = new Set([0x6c, 0x6d, 0x6e, 0x6f]); /** A carrier that never opened: no host was heard at all. */ const NEVER_OPENED = -2; -/** Why a dial through the page server's bridge never opened. The browser hides the server's - * answer to a refused upgrade, so this names only where it failed. */ -const BRIDGE_UNOPENED = - "this page's server couldn't open a connection to the host. Try again in a minute, and if it keeps happening, check that WebSocket connections reach the server"; - /** WebTransport, or a WebSocket through the page server's bridge. */ type CarrierKind = "wt" | "ws"; /** The carrier that last opened for each origin, for the page's lifetime: a reconnect or a door's @@ -358,8 +354,8 @@ export class Engine { mod.__pfOnClosed = (code, reason) => this.onClosed(code, reason); mod.__pfOnRefused = (code, reason) => this.onClosed(code, reason); mod.__pfOnRedirect = (port, certHash) => this.onRedirect(port, certHash); - mod.__pfOnLaunchNotice = (text) => { - this.launchNotice = { text, at: performance.now() }; + mod.__pfOnLaunchNotice = (verdict) => { + this.launchNotice = { text: launchNotice(verdict), at: performance.now() }; }; mod.__pfOnRumble = (pad, low, high, lt, rt, ms) => playRumble(navigator.getGamepads(), pad, low, high, lt, rt, ms); mod.__pfOnCursorShape = (serial, w, h, hx, hy, rgba) => this.cursor.shape(serial, w, h, hx, hy, rgba); @@ -373,11 +369,11 @@ export class Engine { */ static async create(opts: EngineOptions): Promise { if (!decodeSupported()) { - throw new Error("this browser can't decode video. Open this page in a current Chrome, Edge, Safari or Firefox"); + throw new Error(words.browser_cannot_decode()); } // WebTransport and the device key exist only there; plain http on a LAN address is not one. if (!isSecureContext) { - throw new Error("this page isn't on an https address, so the browser won't stream from it. Open it over https"); + throw new Error(words.browser_needs_https()); } const [mod, codecs, channels, gpu] = await Promise.all([loadModule(), decodableCodecs(), playableChannels(), webgpuUsable()]); return new Engine(mod, opts, codecs, channels, gpu); @@ -454,7 +450,7 @@ export class Engine { return this.set({ kind: "error", origin, - message: "browser streaming is off on this host. Turn it on in the host's console, under Host → Settings, then restart the host", + message: words.browser_plane_off(), }); } this.plane = b.plane; @@ -483,8 +479,7 @@ export class Engine { return this.set({ kind: "error", origin, - message: - "this host still has its older identity, which a browser can't pair with. Moving it to the new one means unpairing its other devices, restarting it and pairing them again", + message: words.browser_legacy_identity(), }); } @@ -492,7 +487,7 @@ export class Engine { const stored = pf.hosts.fingerprint(origin); const expect = opts.expectFingerprint?.toLowerCase(); if (stored && expect && stored.toLowerCase() !== expect) { - return this.set({ kind: "untrusted", origin, reason: "the link names a different host than the one paired here" }); + return this.set({ kind: "untrusted", origin, reason: words.browser_link_other_host() }); } const known = stored ?? expect; if (known) { @@ -738,7 +733,7 @@ export class Engine { this.lastFrames = 0; this.lastSecond = performance.now(); this.launchNotice = this.sdrNotice - ? { text: "This browser can't show HDR video, so the stream is in SDR.", at: performance.now() } + ? { text: words.browser_notice_no_hdr(), at: performance.now() } : null; this.sdrNotice = false; this.access = { seq: 0, grants: 0, deadline: null }; @@ -801,7 +796,7 @@ export class Engine { return { role: ROLES[Number(line.slice(0, tab))] ?? "primary", text: line.slice(tab + 1) }; }); // For a player who wonders why this stream is laggier than the network suggests. - if (this.carrierKind === "ws") lines.push({ role: "muted", text: "Carrier: WebSocket via page server" }); + if (this.carrierKind === "ws") lines.push({ role: "muted", text: words.browser_overlay_carrier_ws() }); return lines; } @@ -1060,7 +1055,7 @@ export class Engine { this.set({ kind: "error", origin, - message: "this browser couldn't open its device key. Allow this site to store data, then try again", + message: words.browser_device_key(), }); } @@ -1127,7 +1122,7 @@ export class Engine { if (!carrier || !opening) { if (fallback) return fallback(); carrierHint.delete(origin); - const said = kind === "ws" ? BRIDGE_UNOPENED : "the browser refused the WebTransport session"; + const said = kind === "ws" ? words.browser_bridge_unopened() : words.browser_wt_refused(); return this.set({ kind: "error", origin, message: said }); } if (fallback) this.silence = setTimeout(() => this.mod.__pfCarrier === carrier && fallback(), WT_SILENCE_MS); @@ -1185,7 +1180,7 @@ export class Engine { if (this.host !== host || this.origin !== origin) return; if (e instanceof DeviceRefused && e.status === 401) return this.set({ kind: "forgotten", origin }); if (e instanceof VersionSkew) return this.set({ kind: "error", origin, message: e.message, skew: true }); - if (e instanceof Error && e.message === TOO_MANY) return this.set({ kind: "error", origin, message: TOO_MANY }); + if (e instanceof TooMany) return this.set({ kind: "error", origin, message: e.message }); this.set({ kind: "ready", origin, host }); } @@ -1211,8 +1206,8 @@ export class Engine { origin, message: this.carrierKind === "ws" - ? BRIDGE_UNOPENED - : `couldn't reach the host on UDP ${this.seatPlane?.port ?? this.plane?.port}, its browser streaming port. Check that nothing between this device and the host blocks it`, + ? words.browser_bridge_unopened() + : words.browser_udp_unreachable({ port: this.seatPlane?.port ?? this.plane?.port ?? "?" }), }); } switch (this.state.kind) { @@ -1254,9 +1249,9 @@ export class Engine { } const message = code === CLOSE.HOST_POWER - ? "the host is powering down" + ? words.reject_host_power() : code === CLOSE.ACCESS_EXPIRED - ? "this device's access to the host has expired" + ? words.reject_access_expired() : said || (code < 0 ? "the connection was lost" : `the host closed the session (code ${code})`); this.stopSession(); this.set({ kind: "error", origin, message }); @@ -1326,7 +1321,7 @@ export class Engine { this.knockSince = 0; this.stopSession(); this.mod._pf_wt_close?.(); - this.set({ kind: "pair-refused", origin, reason: "nobody approved the request on the host in time" }); + this.set({ kind: "pair-refused", origin, reason: words.reject_approval_timeout() }); } return; } @@ -1341,7 +1336,7 @@ export class Engine { // The host sent something this page can't read: nothing after it will be either. if (phase === SESSION.FAILED) { this.stopSession(); - this.set({ kind: "error", origin, message: "this page couldn't read what the host sent", skew: true }); + this.set({ kind: "error", origin, message: words.browser_reply_unreadable(), skew: true }); this.mod._pf_wt_close?.(); return; } @@ -1392,8 +1387,11 @@ export class Engine { const now = performance.now(); // A codec fallback names the codec that took over, which only `Welcome` says. if (this.fellBackFrom && v?.codec) { - const pinned = this.refused & CODEC_BIT[this.tunable.codec] ? ", ignoring the Video codec setting" : ""; - const text = `This browser can't decode ${CODEC_NAME[this.fellBackFrom]}, so the stream uses ${CODEC_NAME[v.codec]}${pinned}.`; + const from = CODEC_NAME[this.fellBackFrom] ?? ""; + const to = CODEC_NAME[v.codec] ?? ""; + const text = this.refused & CODEC_BIT[this.tunable.codec] + ? words.browser_codec_fallback_pinned({ from, to }) + : words.browser_codec_fallback({ from, to }); this.launchNotice = { text, at: now }; this.fellBackFrom = 0; } diff --git a/packages/stream/src/game-end.test.ts b/packages/stream/src/game-end.test.ts index 01f7862..cc9b229 100644 --- a/packages/stream/src/game-end.test.ts +++ b/packages/stream/src/game-end.test.ts @@ -1,6 +1,9 @@ import assert from "node:assert/strict"; import { test } from "node:test"; import { gameEndNotice, gameEndOf, gameGone } from "./game-end.ts"; +import { useEnglish } from "./words.testing.ts"; + +useEnglish(); test("a status maps to what the player is told, in the native clients' words", () => { assert.equal(gameEndOf(200).kind, "ended"); diff --git a/packages/stream/src/game-end.ts b/packages/stream/src/game-end.ts index f22752e..b1df57a 100644 --- a/packages/stream/src/game-end.ts +++ b/packages/stream/src/game-end.ts @@ -1,6 +1,8 @@ // What asking the host to end a game came to (`POST /api/v1/game/end`), in the words every // punktfunk client uses: the native clients' `GameEnd`, line for line. +import { words } from "./words.ts"; + export type GameEnd = | { kind: "ended" } /** 409: the host had nothing of this title left to end. */ @@ -16,7 +18,7 @@ export function gameEndOf(status: number): GameEnd { if (status === 409) return { kind: "not-running" }; if (status === 401 || status === 404) return { kind: "unsupported" }; if (status === 403) return { kind: "expired" }; - return { kind: "failed", why: `the host refused it (${status})` }; + return { kind: "failed", why: words.error_mgmt_refused({ code: status }) }; } /** The game is gone, so a stream that was playing it can end. */ @@ -28,14 +30,14 @@ export function gameGone(e: GameEnd): boolean { export function gameEndNotice(e: GameEnd, title: string): string { switch (e.kind) { case "ended": - return `Ended ${title}.`; + return words.lib_end_game_done({ title }); case "not-running": - return `${title} isn't running any more.`; + return words.lib_end_game_not_running({ title }); case "unsupported": - return "This host needs an update to end games from here."; + return words.lib_end_game_unsupported(); case "expired": - return "This device's access to the host has expired."; + return words.lib_end_game_expired(); case "failed": - return `Couldn't end ${title} \u2014 ${e.why}`; + return words.lib_end_game_failed({ title, why: e.why }); } } diff --git a/packages/stream/src/host.ts b/packages/stream/src/host.ts index c52374b..359628f 100644 --- a/packages/stream/src/host.ts +++ b/packages/stream/src/host.ts @@ -23,7 +23,8 @@ import { Effect } from "effect"; import { SchemaError } from "effect/Schema"; import { type GameEnd, gameEndOf } from "./game-end.ts"; import { PAGE_LIMIT, walkPages } from "./pages.ts"; -import { renewPass, serverFetch, TOO_MANY } from "./pass.ts"; +import { renewPass, serverFetch, TooMany } from "./pass.ts"; +import { hostWord, words } from "./words.ts"; export { DeviceRefused }; export type LibraryEntry = api.OperatorGameEntry; @@ -217,11 +218,12 @@ export function statusOf(e: unknown): number | undefined { return (e as { response?: { status?: number } } | null)?.response?.status; } -/** The host's own sentence for a refusal, when its body carries one, else `fallback`. */ +/** The host's sentence for a refusal, when its body carries one, else `fallback`: its message + * `apierr_` in the page's language, else the English it sent beside it. */ async function refusal(res: Response, fallback: string): Promise { try { - const body = (await res.json()) as { error?: string }; - return body.error ?? fallback; + const body = (await res.json()) as { error?: string; code?: string; params?: Record }; + return hostWord(body.code && `apierr_${body.code}`, body.params, body.error ?? fallback); } catch { return fallback; } @@ -230,14 +232,10 @@ async function refusal(res: Response, fallback: string): Promise { /** The SDK's errors, as the three things the app can act on. */ function translate(operation: string, e: unknown): Error { const cause = unwrap(e); - if (statusOf(cause) === 429) return new Error(TOO_MANY); + if (statusOf(cause) === 429) return new TooMany(); // The sign-in: only a 401 says the host no longer knows this device. if (cause instanceof DeviceRefused && cause.status !== 401) { - return new Error( - cause.status === 429 - ? TOO_MANY - : "this browser couldn't sign in to the host. Try again in a moment", - ); + return cause.status === 429 ? new TooMany() : new Error(words.browser_sign_in_failed()); } if (cause instanceof DeviceRefused) return cause; if (cause instanceof SchemaError) return new VersionSkew(operation, String(cause)); diff --git a/packages/stream/src/index.ts b/packages/stream/src/index.ts index 3547d50..7f59771 100644 --- a/packages/stream/src/index.ts +++ b/packages/stream/src/index.ts @@ -50,7 +50,8 @@ export { export { bootstrap, bootstrapUrl, hosts, originOf, reach, reachTarget, type Bootstrap, type KnownHost, type Plane, type Reach } from "./pf-connect.ts"; export { deviceName, exitApp, packaged, remoteKey, tizen, tizenInfo } from "./platform.ts"; export { tunnelFetch, type TunnelFetch } from "./tunnel.ts"; -export { onPass, serverFetch, TOO_MANY } from "./pass.ts"; +export { onPass, serverFetch } from "./pass.ts"; +export { type HostWords, setWords, type Words } from "./words.ts"; export { tvBack } from "./input.ts"; export { type LinkError, linkFor, type PageLink, parseLink } from "./links.ts"; export type { VideoPlane, UploadStats } from "./video-surface.ts"; diff --git a/packages/stream/src/pass.ts b/packages/stream/src/pass.ts index 8467ff8..5cf61b0 100644 --- a/packages/stream/src/pass.ts +++ b/packages/stream/src/pass.ts @@ -3,10 +3,17 @@ // kept with the fingerprints of the hosts it was proven to. `serverFetch` is the one place it, // and the paired host's fingerprint, go on a request. +import { words } from "./words.ts"; + const KEY = "punktfunk.pass"; -/** What a `429` from this page's own server means to the person reading it. */ -export const TOO_MANY = "too many requests from this address. Wait a minute, then try again"; +/** A `429` from this page's own server: too many requests from this address. */ +export class TooMany extends Error { + constructor() { + super(words.browser_too_many()); + this.name = "TooMany"; + } +} interface Held { pass: string; diff --git a/packages/stream/src/pf-connect.test.ts b/packages/stream/src/pf-connect.test.ts index 823108c..73855d0 100644 --- a/packages/stream/src/pf-connect.test.ts +++ b/packages/stream/src/pf-connect.test.ts @@ -12,8 +12,11 @@ import { test } from "node:test"; import assert from "node:assert/strict"; +import { useEnglish } from "./words.testing.ts"; import { verify, hostFingerprint, reach, reachWhy, type Plane } from "./pf-connect.ts"; +useEnglish(); + // A full `Plane`, as the route publishes one; the two attestation fields are the ones under // test. Narrowed to `Required` so the test can read them without a null check on every line. const VECTOR: Required = { @@ -37,7 +40,7 @@ test("a real host's attestation verifies", async () => { test("a host that is not the one paired with is refused", async () => { await assert.rejects( () => verify(VECTOR, "0".repeat(64)), - /not the host that was paired with/, + /not the host that was paired with/i, ); }); @@ -47,7 +50,7 @@ test("the signature must be over this hash, by this key", async () => { // A different hash: the certificate is still ours, the signature no longer names it. await assert.rejects( () => verify({ ...VECTOR, cert_hash_sha256: "ab".repeat(32) }, fp), - /does not verify/, + /does not verify/i, ); // A bent signature. `atob`-clean, structurally valid, wrong. @@ -60,7 +63,7 @@ test("an unattested host cannot be dialled by a paired browser", async () => { const { cert_hash_sig: _sig, host_cert_der: _der, ...unattested } = VECTOR; await assert.rejects( () => verify(unattested, fp), - /published no attestation/, + /published no attestation/i, ); }); diff --git a/packages/stream/src/pf-connect.ts b/packages/stream/src/pf-connect.ts index d88c11d..2d31503 100644 --- a/packages/stream/src/pf-connect.ts +++ b/packages/stream/src/pf-connect.ts @@ -18,7 +18,8 @@ // over the short-lived WebTransport hash, and `verify` refuses to dial a host that cannot produce // it. -import { ours, serverFetch, TOO_MANY } from "./pass.ts"; +import { ours, serverFetch, TooMany } from "./pass.ts"; +import { words } from "./words.ts"; import type { ProfilePick } from "./profiles.ts"; import { derToRaw, fromBase64, hexToBytes } from "@punktfunk/host/core"; @@ -50,21 +51,21 @@ const hex = (b: Uint8Array): string => // error the user reads as "the host is down". export function originOf(input: string | null | undefined): string { const raw = String(input ?? "").trim().replace(/\/+$/, ""); - if (!raw) throw new Error("enter the host's address"); + if (!raw) throw new Error(words.hosts_error_address_empty()); let url: URL; try { url = new URL(/^https?:\/\//.test(raw) ? raw : `https://${raw}`); } catch { // The browser's own message quotes the `https://` we just added, which reads as though the // user typed it. Say what they can act on instead. - throw new Error(`"${raw}" is not an address — try something like 192.168.1.25`); + throw new Error(words.hosts_error_address_invalid({ address: raw })); } // A host is https. Loopback is the one exception: it is a secure context in every browser, // and a dev server there is how this client is developed against a real host without // accepting its certificate — `npm run dev` proxies `/api` to one. const loopback = /^(localhost|127\.0\.0\.1|\[::1\])$/.test(url.hostname); if (url.protocol !== "https:" && !(url.protocol === "http:" && loopback)) { - throw new Error("a punktfunk host is https"); + throw new Error(words.browser_host_https()); } if (!url.port) url.port = String(DEFAULT_MGMT_PORT); return url.origin; @@ -93,7 +94,7 @@ export async function reachWhy(origin: string, timeoutMs = 4000): Promise<{ reac cache: "no-store", signal: abort.signal, }); - if (r.status === 429) return { reach: "unreachable", said: TOO_MANY }; + if (r.status === 429) return { reach: "unreachable", said: words.browser_too_many() }; if (r.status === 503 || r.status === 504) return { reach: "unreachable" }; if (r.status === 502 || (own && !r.ok)) { // Plain text is the page's server speaking; anything else (a proxy's HTML page) says nothing. @@ -178,9 +179,9 @@ export async function reachTarget(target: string | HostTarget): Promise { /** What the host says about its browser plane. Everything here is public. */ export async function fetchPlane(origin: string): Promise { const r = await serverFetch()(`${origin}/api/v1/webtransport`, { cache: "no-store" }); - if (r.status === 404) throw new Error("this host does not offer the browser plane"); - if (r.status === 429) throw new Error(TOO_MANY); - if (!r.ok) throw new Error(`the host answered ${r.status}`); + if (r.status === 404) throw new Error(words.browser_no_plane()); + if (r.status === 429) throw new TooMany(); + if (!r.ok) throw new Error(words.browser_host_status({ status: r.status })); return (await r.json()) as Plane; } @@ -191,12 +192,12 @@ export async function fetchPlane(origin: string): Promise { // not dialled — the point is to refuse before the connection, not after. export async function verify(plane: Plane, hostFingerprint: string): Promise { if (!plane.cert_hash_sig || !plane.host_cert_der) { - throw new Error("this host published no attestation, so a paired browser cannot dial it"); + throw new Error(words.browser_no_attestation()); } const der = fromBase64(plane.host_cert_der); const seen = hex(new Uint8Array(await crypto.subtle.digest("SHA-256", buffer(der)))); if (seen !== hostFingerprint) { - throw new Error("this is not the host that was paired with"); + throw new Error(words.browser_not_paired_host()); } const key = await crypto.subtle.importKey( "spki", @@ -213,7 +214,7 @@ export async function verify(plane: Plane, hostFingerprint: string): Promise der[i + j] === b)) return der.subarray(i, i + 91); } - throw new Error("the host certificate carries no P-256 key"); + throw new Error(words.browser_cert_no_key()); } /** What this browser remembers about one host. Nothing here is secret. */ diff --git a/packages/stream/src/profiles.test.ts b/packages/stream/src/profiles.test.ts index 44ef35f..a7c343c 100644 --- a/packages/stream/src/profiles.test.ts +++ b/packages/stream/src/profiles.test.ts @@ -4,6 +4,9 @@ import { test } from "node:test"; import assert from "node:assert/strict"; import { initials, pickOf, pickerDecision, profileNote, seatGate, type ProfileRow } from "./profiles.ts"; +import { useEnglish } from "./words.testing.ts"; + +useEnglish(); const row = (id: string, display_name: string, more: Partial = {}): ProfileRow => ({ id, display_name, ...more }); const MIA = row("a1", "Mia"); @@ -66,6 +69,15 @@ test("the seat decides: dial, wake, wait or refuse", () => { } }); +test("a seat line the host names by id reads in the page's words, else as the host sent it", () => { + const starting = (seat: object) => row("x", "X", { seat: { state: "starting", detail: "The host's English", ...seat } }); + const named = starting({ detail_id: "seatline_stage_host_try", detail_params: { attempt: "2", total: "3" } }); + assert.equal(profileNote(named), "Starting Punktfunk on the seat (try 2 of 3)…"); + assert.deepEqual(seatGate(named), { kind: "wait", detail: "Starting Punktfunk on the seat (try 2 of 3)…" }); + assert.equal(profileNote(starting({ detail_id: "seatline_from_a_newer_host" })), "The host's English"); + assert.equal(profileNote(starting({ detail_id: "seatline_sign_in_once" })), "The host's English", "a value it needs is missing"); +}); + test("a card says what its seat is doing", () => { assert.equal(profileNote(MIA), undefined); assert.equal(profileNote(row("x", "X", { seat: { state: "occupied", occupant: "Pixel" } })), "In use by Pixel"); diff --git a/packages/stream/src/profiles.ts b/packages/stream/src/profiles.ts index b93cf37..a41aa58 100644 --- a/packages/stream/src/profiles.ts +++ b/packages/stream/src/profiles.ts @@ -4,6 +4,8 @@ // card's line — so a browser asks, wakes and waits exactly as the native clients do. The host // refuses a dial to a seat that isn't up, so the gate runs before the dial, not after. +import { hostWord, words } from "./words.ts"; + /** One row of `GET /api/v1/profiles/enumerate`, the fields this page reads. */ export interface ProfileRow { readonly id: string; @@ -21,8 +23,11 @@ export interface ProfileRow { export interface SeatRow { /** `ready`, `starting`, `stopped`, `occupied` or `unavailable`; a newer word reads as ready. */ readonly state: string; - /** The progress line while starting, or why while unavailable. */ + /** The progress line while starting, or why while unavailable, in the host's English. */ readonly detail?: string | null; + /** The host's message for `detail` (`seatline_…`) and the values it reads. */ + readonly detail_id?: string | null; + readonly detail_params?: Readonly> | null; /** The device playing on it while occupied. */ readonly occupant?: string | null; readonly steam_sign_in?: unknown; @@ -61,8 +66,9 @@ export type SeatGate = /** How often the list is read again while a seat comes up. */ export const SEAT_POLL_MS = 2000; -/** The host's refusal of another profile's seat (its 403), in its own words. */ -export const WAKE_REFUSED = "This device isn't allowed to start another profile's seat."; +/** The seat's own line: the host's message in the page's language, else its English. */ +const seatDetail = (seat: SeatRow): string | null | undefined => + hostWord(seat.detail_id, seat.detail_params, seat.detail); export const pickOf = (p: ProfileRow): ProfilePick => ({ id: p.id, @@ -110,10 +116,12 @@ export function seatGate(p: ProfileRow): SeatGate { switch (seat.state) { case "stopped": return { kind: "wake" }; - case "starting": - return { kind: "wait", ...(seat.detail ? { detail: seat.detail } : {}) }; + case "starting": { + const detail = seatDetail(seat); + return { kind: "wait", ...(detail ? { detail } : {}) }; + } case "unavailable": - return { kind: "refuse", line: seat.detail ?? "That profile can't play on this host right now." }; + return { kind: "refuse", line: seatDetail(seat) ?? words.reject_seat_unavailable() }; default: return { kind: "dial" }; } @@ -125,13 +133,13 @@ export function profileNote(p: ProfileRow): string | undefined { if (!seat) return undefined; switch (seat.state) { case "occupied": - return seat.occupant ? `In use by ${seat.occupant}` : "In use"; + return seat.occupant ? words.profile_in_use_by({ device: seat.occupant }) : words.profile_in_use(); case "starting": - return seat.detail ?? "Getting ready…"; + return seatDetail(seat) ?? words.profile_getting_ready(); case "unavailable": - return seat.detail ?? "Unavailable"; + return seatDetail(seat) ?? words.profile_unavailable(); default: - return seat.steam_sign_in === true ? "Steam sign-in once" : undefined; + return seat.steam_sign_in === true ? words.profile_steam_sign_in() : undefined; } } @@ -146,10 +154,10 @@ export function initials(name: string): string { } /** The line while a seat comes up. */ -export const wakingLine = (name: string): string => `Getting ${name}'s desk ready…`; +export const wakingLine = (name: string): string => words.profile_waking({ name }); /** The line a failed wake ends a seat wait with: a refusal as its own sentence, anything else * under the desk it was for. */ export function wakeFailed(name: string, status: number | undefined, why: string): string { - return status === 403 ? WAKE_REFUSED : `Couldn't wake ${name}'s desk — ${why}`; + return status === 403 ? words.profile_wake_refused() : words.profile_wake_failed({ name, reason: why }); } diff --git a/packages/stream/src/words.test.ts b/packages/stream/src/words.test.ts new file mode 100644 index 0000000..34f057f --- /dev/null +++ b/packages/stream/src/words.test.ts @@ -0,0 +1,29 @@ +// The engine's words: a message it names, a host message by id, and what an id this build lacks reads as. + +import assert from "node:assert/strict"; +import { test } from "node:test"; +import { hostWord, launchNotice, setWords, words } from "./words.ts"; +import { useEnglish } from "./words.testing.ts"; + +test("a message nobody installed reads as its key", () => { + setWords({} as never); + assert.equal(words.browser_too_many(), "browser_too_many"); + assert.equal(hostWord("seatline_seats_off", null, "the host's English"), "the host's English"); +}); + +test("a launch verdict reads by its message id, else as the host sent it", () => { + useEnglish(); + const sent = (v: object) => launchNotice(JSON.stringify(v)); + assert.equal( + sent({ english: "x", id: "launch_closed_at_once", params: { title: "Hades", seconds: "3" } }), + "Couldn't start Hades — it closed again after 3 s.", + ); + assert.equal(sent({ english: "The host's English", id: "launch_from_a_newer_host", params: {} }), "The host's English"); + assert.equal(sent({ english: "No id", id: "", params: {} }), "No id"); + assert.equal( + sent({ english: "The host's English", id: "launch_closed_at_once", params: { title: "Hades" } }), + "The host's English", + "a value the message reads is missing", + ); + assert.equal(launchNotice("not json"), "not json"); +}); diff --git a/packages/stream/src/words.testing.ts b/packages/stream/src/words.testing.ts new file mode 100644 index 0000000..a9a20b3 --- /dev/null +++ b/packages/stream/src/words.testing.ts @@ -0,0 +1,40 @@ +// The English messages for a test, read from the files `scripts/l10n-messages.mjs` copied for the +// web app. A test that asserts wording installs them; every other test reads message keys. + +import { readFileSync } from "node:fs"; +import { setWords, type Words } from "./words.ts"; + +const PARTS = ["common", "client", "browser", "host"]; + +const messages = new Map(); +for (const part of PARTS) { + const file = new URL(`../../../apps/web/l10n/${part}/en.json`, import.meta.url); + for (const [key, text] of Object.entries(JSON.parse(readFileSync(file, "utf8")) as Record)) { + if (typeof text === "string") messages.set(key, text); + } +} + +/** Fill `{name}` from `params`. */ +const fill = (text: string, params: Record = {}): string => + text.replace(/\{(\w+)\}/g, (_, name: string) => String(params[name])); + +/** The English text of message `id`, else `undefined`: no such message, or a value it reads is + * missing from `params`. */ +export function english(id: string, params?: Record | null): string | undefined { + const text = messages.get(id); + const given = params ?? {}; + if (text === undefined || [...text.matchAll(/\{(\w+)\}/g)].some((m) => !(m[1]! in given))) return undefined; + return fill(text, given); +} + +/** Install the English messages as the page's words. */ +export function useEnglish(): void { + const words = new Proxy({} as Words, { + get: (_, id: string) => (params?: Record) => { + const text = messages.get(id); + if (text === undefined) throw new Error(`no English message ${id}`); + return fill(text, params); + }, + }); + setWords(words, english); +} diff --git a/packages/stream/src/words.ts b/packages/stream/src/words.ts new file mode 100644 index 0000000..a18bd32 --- /dev/null +++ b/packages/stream/src/words.ts @@ -0,0 +1,109 @@ +// What the engine says to a person. The sentences are the monorepo's messages (`l10n/messages`); +// the page that draws them installs its compiled ones with `setWords`, so this library carries +// no wording and no Paraglide. A message the page never installed reads as its key. + +/** The messages the engine reads, by key, as the compiled `m` namespace exports them. */ +export interface Words { + grant_level_full(): string; + grant_level_controller(): string; + grant_level_view(): string; + grant_level_custom(): string; + grant_now_full(): string; + grant_now_controller(): string; + grant_now_view(): string; + grant_now_custom(): string; + grant_chip_ends(p: { time: string }): string; + grant_chip_ends_soon(): string; + grant_ends_in(p: { time: string }): string; + grant_ends_soon(): string; + grant_remaining_minutes(p: { minutes: number }): string; + grant_remaining_hours(p: { hours: number }): string; + grant_remaining_hours_minutes(p: { hours: number; minutes: number }): string; + error_mgmt_refused(p: { code: number }): string; + lib_end_game_done(p: { title: string }): string; + lib_end_game_not_running(p: { title: string }): string; + lib_end_game_unsupported(): string; + lib_end_game_expired(): string; + lib_end_game_failed(p: { title: string; why: string }): string; + profile_wake_refused(): string; + reject_seat_unavailable(): string; + profile_in_use_by(p: { device: string }): string; + profile_in_use(): string; + profile_getting_ready(): string; + profile_unavailable(): string; + profile_steam_sign_in(): string; + profile_waking(p: { name: string }): string; + profile_wake_failed(p: { name: string; reason: string }): string; + browser_too_many(): string; + browser_sign_in_failed(): string; + hosts_error_address_empty(): string; + hosts_error_address_invalid(p: { address: string }): string; + browser_host_https(): string; + browser_no_plane(): string; + browser_no_attestation(): string; + browser_not_paired_host(): string; + browser_bad_signature(): string; + browser_cert_no_key(): string; + browser_host_status(p: { status: number }): string; + browser_bridge_unopened(): string; + browser_cannot_decode(): string; + browser_needs_https(): string; + browser_plane_off(): string; + browser_legacy_identity(): string; + browser_link_other_host(): string; + browser_device_key(): string; + browser_wt_refused(): string; + browser_reply_unreadable(): string; + browser_udp_unreachable(p: { port: number | string }): string; + reject_host_power(): string; + reject_access_expired(): string; + reject_approval_timeout(): string; + browser_overlay_carrier_ws(): string; + browser_notice_no_hdr(): string; + browser_codec_fallback(p: { from: string; to: string }): string; + browser_codec_fallback_pinned(p: { from: string; to: string }): string; +} + +/** A message the host named by id (`apierr_`, `seatline_…`, `launch_…`), filled from the + * `params` it sent. `undefined` for an id this build has no message for, or one that needs a + * value the host left out: the caller shows the host's English then. */ +export type HostWords = (id: string, params?: Record | null) => string | undefined; + +let installed: Partial = {}; +let hostWords: HostWords = () => undefined; + +/** Install the page's messages: the compiled `m` namespace and, for the ids a host sends, a + * lookup by key. */ +export function setWords(words: Words, host?: HostWords): void { + installed = words; + hostWords = host ?? (() => undefined); +} + +/** The installed messages. */ +export const words = new Proxy({} as Words, { + get: (_, key: string) => (params?: unknown) => { + const message = installed[key as keyof Words] as ((p?: unknown) => string) | undefined; + return message ? message(params) : key; + }, +}); + +/** A launch verdict as `rust/session.rs` hands it over — JSON of the host's `english`, and its + * message `id` and `params` when it named one — as the sentence for the player. Anything that + * does not parse reads as it came. */ +export function launchNotice(json: string): string { + try { + const said = JSON.parse(json) as { english?: string; id?: string; params?: Record }; + return hostWord(said.id, said.params, said.english ?? ""); + } catch { + return json; + } +} + +/** The host's message `id` in the page's language, else `english`. */ +export function hostWord( + id: string | null | undefined, + params: Record | null | undefined, + english: E, +): string | E { + return (id ? hostWords(id, params) : undefined) ?? english; +} From 683391fa18fd2db8c597e0db7c90f6cccdae5d61 Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Fri, 6 Nov 2026 22:53:04 +0100 Subject: [PATCH 04/13] feat(stream): hand a launch verdict to the page with its message id The page showed the host's English for a launch that did not give the player their game. The verdict now crosses as JSON that carries the host's message id and its values beside the English, so the page can word it. A host that names no message still shows its own sentence. --- packages/stream/rust/session.rs | 35 +++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/packages/stream/rust/session.rs b/packages/stream/rust/session.rs index 49f9535..248f66a 100644 --- a/packages/stream/rust/session.rs +++ b/packages/stream/rust/session.rs @@ -357,9 +357,9 @@ unsafe extern "C" { /// The session runs on another host of this box: dial `port` on the address dialed, /// pinning `cert_hash` (64 hex characters, borrowed for the call). fn pf_redirect(port: u32, cert_hash: *const u8, len: u32); - /// The host's sentence for a launch that did not give the player their game. UTF-8, - /// borrowed for the call. - fn pf_launch_notice(text: *const u8, len: u32); + /// The host's verdict on a launch that did not give the player their game, as JSON + /// (`launch_notice`). UTF-8, borrowed for the call. + fn pf_launch_notice(json: *const u8, len: u32); /// A host pointer bitmap: straight-alpha RGBA, `w * h * 4` bytes, borrowed for the call. fn pf_cursor_shape( serial: u32, @@ -714,13 +714,13 @@ fn on_frame(c: &mut Client, ty: u64, body: &[u8]) { } } LaunchOutcome::TYPE => { - if let Some(text) = LaunchOutcome::from_body(body) + if let Some(said) = LaunchOutcome::from_body(body) .ok() .as_ref() - .and_then(LaunchOutcome::notice) + .and_then(launch_notice) { // SAFETY: the string is borrowed for a call into JavaScript that copies it. - unsafe { pf_launch_notice(text.as_ptr(), text.len() as u32) }; + unsafe { pf_launch_notice(said.as_ptr(), said.len() as u32) }; } } // `Pending` repeats while the host's console decides; the page shows its own wait. @@ -728,6 +728,29 @@ fn on_frame(c: &mut Client, ty: u64, body: &[u8]) { } } +/// The verdict as JSON for the page, which words it: the host's `english`, and when it named a +/// message its `id` and the values that fill it. `None` when the player got their game. +fn launch_notice(outcome: &LaunchOutcome) -> Option { + if !outcome.kind.needs_telling() + || (outcome.message.is_empty() && outcome.message_id.is_empty()) + { + return None; + } + let params: serde_json::Map = outcome + .message_params + .iter() + .map(|(name, value)| (name.clone(), value.clone().into())) + .collect(); + Some( + serde_json::json!({ + "english": outcome.message, + "id": outcome.message_id, + "params": params, + }) + .to_string(), + ) +} + /// The host accepted: build the session the `ServerHello` describes and say we are ready. fn on_server_hello(c: &mut Client, server: ServerHello) { let welcome = server.welcome; From 0a90c974b3ac53fe6e89ba04ef7a1cf3e1604b57 Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Fri, 6 Nov 2026 22:53:04 +0100 Subject: [PATCH 05/13] feat(web): install the page's messages in the engine The engine takes its words from the page. Each message it reads is picked by name, so the bundle keeps only those, and the host's own message families are looked up by id, which is the one place a whole family ships. A message the host names that this build lacks, or whose values the host left out, reads as the host's English. --- apps/web/src/words.ts | 110 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 apps/web/src/words.ts diff --git a/apps/web/src/words.ts b/apps/web/src/words.ts new file mode 100644 index 0000000..c57d498 --- /dev/null +++ b/apps/web/src/words.ts @@ -0,0 +1,110 @@ +// The page's words: the compiled messages, handed to the engine, which carries none of its own. +// Imported first by `app.ts`, before anything can say a sentence. + +import { setWords } from "@punktfunk/stream"; +import { m } from "./paraglide/messages.js"; + +/** The host's messages by id: its API errors, seat lines, launch verdicts and refusals. A host + * names one by a string, so these are looked up by key and are the only ones kept whole. */ +const HOST: Record) => string> = {}; +for (const [path, module] of Object.entries( + import.meta.glob("./paraglide/messages/{apierr,launch,seatline,reject}_*.js", { eager: true }), +)) { + const id = path.slice(path.lastIndexOf("/") + 1, -".js".length); + HOST[id] = (module as Record) => string>)[id]!; +} + +/** + * The message `id` the host named, filled from its `params`; `undefined` for an id this build has + * no message for, or one whose value the host left out. A page and a host a version apart + * disagree on ids, so a miss is normal and the caller shows the host's English. + */ +export function hostMessage(id: string, params?: Record | null): string | undefined { + const message = Object.hasOwn(HOST, id) ? HOST[id] : undefined; + if (!message) return undefined; + let complete = true; + const given = params ?? {}; + const read = new Proxy(given, { + get(target, key) { + if (typeof key !== "string") return undefined; + if (!Object.hasOwn(target, key)) complete = false; + return target[key]; + }, + }); + const text = message(read); + return complete ? text : undefined; +} + +/** The sentence for an API error `code`: the host message `apierr_`, else `english`. */ +export function apiText( + code: string | null | undefined, + params: Record | null | undefined, + english: E, +): string | E { + return (code ? hostMessage(`apierr_${code}`, params) : undefined) ?? english; +} + +// Picked one by one: handing over the whole namespace would keep every message in the bundle. +setWords( + { + grant_level_full: m.grant_level_full, + grant_level_controller: m.grant_level_controller, + grant_level_view: m.grant_level_view, + grant_level_custom: m.grant_level_custom, + grant_now_full: m.grant_now_full, + grant_now_controller: m.grant_now_controller, + grant_now_view: m.grant_now_view, + grant_now_custom: m.grant_now_custom, + grant_chip_ends: m.grant_chip_ends, + grant_chip_ends_soon: m.grant_chip_ends_soon, + grant_ends_in: m.grant_ends_in, + grant_ends_soon: m.grant_ends_soon, + grant_remaining_minutes: m.grant_remaining_minutes, + grant_remaining_hours: m.grant_remaining_hours, + grant_remaining_hours_minutes: m.grant_remaining_hours_minutes, + error_mgmt_refused: m.error_mgmt_refused, + lib_end_game_done: m.lib_end_game_done, + lib_end_game_not_running: m.lib_end_game_not_running, + lib_end_game_unsupported: m.lib_end_game_unsupported, + lib_end_game_expired: m.lib_end_game_expired, + lib_end_game_failed: m.lib_end_game_failed, + profile_wake_refused: m.profile_wake_refused, + reject_seat_unavailable: m.reject_seat_unavailable, + profile_in_use_by: m.profile_in_use_by, + profile_in_use: m.profile_in_use, + profile_getting_ready: m.profile_getting_ready, + profile_unavailable: m.profile_unavailable, + profile_steam_sign_in: m.profile_steam_sign_in, + profile_waking: m.profile_waking, + profile_wake_failed: m.profile_wake_failed, + browser_too_many: m.browser_too_many, + browser_sign_in_failed: m.browser_sign_in_failed, + hosts_error_address_empty: m.hosts_error_address_empty, + hosts_error_address_invalid: m.hosts_error_address_invalid, + browser_host_https: m.browser_host_https, + browser_no_plane: m.browser_no_plane, + browser_no_attestation: m.browser_no_attestation, + browser_not_paired_host: m.browser_not_paired_host, + browser_bad_signature: m.browser_bad_signature, + browser_cert_no_key: m.browser_cert_no_key, + browser_host_status: m.browser_host_status, + browser_bridge_unopened: m.browser_bridge_unopened, + browser_cannot_decode: m.browser_cannot_decode, + browser_needs_https: m.browser_needs_https, + browser_plane_off: m.browser_plane_off, + browser_legacy_identity: m.browser_legacy_identity, + browser_link_other_host: m.browser_link_other_host, + browser_device_key: m.browser_device_key, + browser_wt_refused: m.browser_wt_refused, + browser_reply_unreadable: m.browser_reply_unreadable, + browser_udp_unreachable: m.browser_udp_unreachable, + reject_host_power: m.reject_host_power, + reject_access_expired: m.reject_access_expired, + reject_approval_timeout: m.reject_approval_timeout, + browser_overlay_carrier_ws: m.browser_overlay_carrier_ws, + browser_notice_no_hdr: m.browser_notice_no_hdr, + browser_codec_fallback: m.browser_codec_fallback, + browser_codec_fallback_pinned: m.browser_codec_fallback_pinned, + }, + hostMessage, +); From 4a40634a65da25c3cc4b6f59109a089930128fec Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Fri, 6 Nov 2026 22:53:13 +0100 Subject: [PATCH 06/13] feat(web): word the host pages from messages The sidebar, the host cards, the screen-reader announcements and the connect, pair, trust and link sheets read the shared messages instead of English literals. A host card's state, a plural count and a key name are arguments, so a language can order them. The link sheet's three sentences are three whole messages. --- apps/web/src/ui/frame.tsx | 21 ++++---- apps/web/src/ui/home.tsx | 35 ++++++------- apps/web/src/ui/pieces.tsx | 13 ++--- apps/web/src/ui/sheets.tsx | 102 +++++++++++++++---------------------- apps/web/src/ui/shell.tsx | 23 +++++---- 5 files changed, 90 insertions(+), 104 deletions(-) diff --git a/apps/web/src/ui/frame.tsx b/apps/web/src/ui/frame.tsx index dbd47cd..4e23472 100644 --- a/apps/web/src/ui/frame.tsx +++ b/apps/web/src/ui/frame.tsx @@ -10,6 +10,7 @@ import { Gamepad2, LibraryBig, type LucideIcon, Monitor, Settings } from "lucide import { motion, stagger, type Variants } from "motion/react"; import type { JSX, ReactNode } from "react"; import { staggerProps } from "@/components/stagger"; +import { m } from "../paraglide/messages.js"; import { BrandMark, Wordmark } from "./brand.tsx"; import type { Actions, Tab } from "./types.ts"; @@ -34,10 +35,10 @@ const PRESS = { scale: 0.9 }; const HOVER = { scale: 1.02 }; const TAP = { scale: 0.98 }; -const TABS: ReadonlyArray<{ tab: Tab; icon: LucideIcon; label: string }> = [ - { tab: "hosts", icon: Monitor, label: "Hosts" }, - { tab: "library", icon: LibraryBig, label: "Library" }, - { tab: "settings", icon: Settings, label: "Settings" }, +const TABS: ReadonlyArray<{ tab: Tab; icon: LucideIcon; label: () => string }> = [ + { tab: "hosts", icon: Monitor, label: () => m.hosts_tab() }, + { tab: "library", icon: LibraryBig, label: () => m.hosts_tab_library() }, + { tab: "settings", icon: Settings, label: () => m.hosts_tab_settings() }, ]; export function Frame({ @@ -62,12 +63,12 @@ export function Frame({ - + {TABS.map(({ tab: t, icon, label }) => ( actions.navigate(t)} @@ -75,8 +76,8 @@ export function Frame({ ))} actions.consoleMode(true)} /> @@ -96,7 +97,7 @@ export function Frame({ - {label} + {label()} ))} diff --git a/apps/web/src/ui/home.tsx b/apps/web/src/ui/home.tsx index 8c96227..7b5897d 100644 --- a/apps/web/src/ui/home.tsx +++ b/apps/web/src/ui/home.tsx @@ -12,6 +12,7 @@ import { Card } from "@/components/ui/card"; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "@/components/ui/dialog"; import { Input } from "@/components/ui/input"; import { Menu, MenuContent, MenuItem, MenuSeparator, MenuTrigger } from "@/components/ui/menu"; +import { m } from "../paraglide/messages.js"; import { Body, PageHead } from "./frame.tsx"; import { bare, ErrorLine, labelOf, status } from "./pieces.tsx"; import type { Actions, HostCard, Screen } from "./types.ts"; @@ -32,11 +33,11 @@ export function Home({ screen, actions }: { screen: HomeScreen; actions: Actions const first = screen.hosts.length === 0; return ( - + {!first && ( )} @@ -59,8 +60,8 @@ export function Home({ screen, actions }: { screen: HomeScreen; actions: Actions actions.setAdding(open)}> - Add a host - The address of a machine running punktfunk on your network. + {m.hosts_add_title()} + {m.hosts_add_hint()} @@ -87,14 +88,14 @@ function AddHostForm({ screen, actions }: { screen: HomeScreen; actions: Actions placeholder="192.168.1.25" autoComplete="off" spellCheck={false} - aria-label="Host address" + aria-label={m.hosts_field_address()} disabled={!!screen.busy} value={address} onChange={(e) => setAddress(e.currentTarget.value)} /> {screen.error && } ); @@ -123,14 +124,14 @@ function HostTile({ host, actions }: { host: HostCard; actions: Actions }): JSX. { if (e.key === "Enter") commit(e.currentTarget.value); if (e.key === "Escape") setEditing(false); }} onBlur={(e) => commit(e.currentTarget.value)} /> - Enter to save, Escape to cancel + {m.browser_hostcard_rename_hint({ save_key: "Enter", cancel_key: "Escape" })} ); @@ -142,7 +143,7 @@ function HostTile({ host, actions }: { host: HostCard; actions: Actions }): JSX. type="button" disabled={host.waking} onClick={() => (asleep ? actions.wake(host.origin) : actions.streamDesktop(host.origin))} - aria-label={`${asleep ? "Wake" : "Stream"} ${label}, ${state.text}`} + aria-label={`${asleep ? m.browser_hostcard_wake_a11y({ host: label }) : m.browser_hostcard_stream_a11y({ host: label })}, ${state.text}`} title={bare(host.origin)} > @@ -170,45 +171,45 @@ function HostTile({ host, actions }: { host: HostCard; actions: Actions }): JSX. - actions.streamDesktop(host.origin)}> - Stream desktop + {m.browser_hostcard_stream_desktop()} {paired && ( actions.browse(host.origin)}> - Browse library + {m.hostcard_browse_library()} )} {paired && ( actions.switchProfile(host.origin)}> - Switch profile… + {m.hostcard_switch_profile()} )} {host.wake && ( actions.wake(host.origin)}> - Wake + {m.hostcard_wake()} )} setEditing(true)}> - Rename + {m.browser_hostcard_rename()} actions.copyLink(host.origin)}> - Copy link + {m.hostcard_copy_link()} actions.forget(host.origin)}> - Forget + {m.hostcard_remove()} diff --git a/apps/web/src/ui/pieces.tsx b/apps/web/src/ui/pieces.tsx index 54d4234..8181eb9 100644 --- a/apps/web/src/ui/pieces.tsx +++ b/apps/web/src/ui/pieces.tsx @@ -6,6 +6,7 @@ import type { JSX, ReactNode } from "react"; import type { BadgeVariant } from "@/components/ui/badge"; import { Card } from "@/components/ui/card"; import { Spinner } from "@/components/ui/spinner"; +import { m } from "../paraglide/messages.js"; import type { HostCard } from "./types.ts"; /** The pages that are a question rather than a list — connect, pair, trust, an error: one card, @@ -80,11 +81,11 @@ export function ago(at?: number): string { /** A host's state as a dot colour and a word. Reachability and pairing are separate facts and * the card shows whichever is the one standing in the way. */ export function status(h: HostCard): { variant: BadgeVariant; text: string; dot: string } { - if (h.waking) return { variant: "outline", text: "Waking…", dot: "bg-warning animate-pulse" }; - if (h.reach === undefined) return { variant: "outline", text: "Checking…", dot: "bg-muted-foreground/40" }; - if (h.reach === "unreachable") return { variant: "outline", text: h.wake ? "Offline · can wake" : "Offline", dot: "bg-muted-foreground/40" }; - if (h.reach === "blocked") return { variant: "warning", text: "Certificate not accepted", dot: "bg-warning" }; + if (h.waking) return { variant: "outline", text: m.browser_hostcard_status_waking(), dot: "bg-warning animate-pulse" }; + if (h.reach === undefined) return { variant: "outline", text: m.browser_hostcard_status_checking(), dot: "bg-muted-foreground/40" }; + if (h.reach === "unreachable") return { variant: "outline", text: h.wake ? m.hostcard_status_offline_wakes() : m.hostcard_status_offline(), dot: "bg-muted-foreground/40" }; + if (h.reach === "blocked") return { variant: "warning", text: m.browser_hostcard_status_cert(), dot: "bg-warning" }; return h.fingerprint - ? { variant: "success", text: "Online", dot: "bg-success" } - : { variant: "warning", text: "Not paired", dot: "bg-warning" }; + ? { variant: "success", text: m.hostcard_status_online(), dot: "bg-success" } + : { variant: "warning", text: m.hostcard_status_not_paired(), dot: "bg-warning" }; } diff --git a/apps/web/src/ui/sheets.tsx b/apps/web/src/ui/sheets.tsx index d5b3a4e..b5813a9 100644 --- a/apps/web/src/ui/sheets.tsx +++ b/apps/web/src/ui/sheets.tsx @@ -5,6 +5,7 @@ import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Spinner } from "@/components/ui/spinner"; +import { m } from "../paraglide/messages.js"; import { bare, ErrorLine, Row, Sheet, Sub } from "./pieces.tsx"; import type { Actions, Screen } from "./types.ts"; @@ -12,15 +13,15 @@ type Props = { screen: Extract; a export function Connecting({ screen, actions }: Props<"connecting">): JSX.Element { const title = - screen.phase === "reaching" ? "Looking for the host" - : screen.phase === "starting" ? "Starting the stream" - : "Connecting"; + screen.phase === "reaching" ? m.browser_dial_reaching() + : screen.phase === "starting" ? m.browser_dial_starting_stream() + : m.dial_connecting(); return ( {bare(screen.origin)} - + ); @@ -30,12 +31,12 @@ export function Connecting({ screen, actions }: Props<"connecting">): JSX.Elemen export function Profiles({ screen, actions }: Props<"profiles">): JSX.Element { const cards = [...screen.cards].sort((a, b) => Number(b.id === screen.saved) - Number(a.id === screen.saved)); return ( - - {screen.gone && {screen.gone} is gone from this host.} + + {screen.gone && {m.profile_gone({ name: screen.gone })}} {screen.error ? ( ) : cards.length === 0 ? ( - No profiles on this host. + {m.profile_none()} ) : (
{cards.map((c, i) => ( @@ -65,7 +66,7 @@ export function Profiles({ screen, actions }: Props<"profiles">): JSX.Element { )} @@ -79,7 +80,7 @@ export function SeatWait({ screen, actions }: Props<"seat">): JSX.Element { {screen.detail && {screen.detail}} - + ); @@ -87,18 +88,9 @@ export function SeatWait({ screen, actions }: Props<"seat">): JSX.Element { export function Accept({ screen, actions }: Props<"accept">): JSX.Element { return ( - - - A punktfunk host signs its own certificate, so your browser will not talk to it until - you say so once. Open this, accept the warning, then come back. - - {screen.again && ( - - Still asking after you accepted it? Then the host is not answering pages like this one: - turn on Browser streaming in its console. Safari reaches a host this way only through a - punktfunk server. - - )} + + {m.browser_accept_body()} + {screen.again && {m.browser_accept_again()}} ): JSX.Element { {screen.url} - - + + ); @@ -121,13 +113,9 @@ export function Pair({ screen, actions }: Props<"pair">): JSX.Element { const submit = () => { const v = pin.trim(); if (v) actions.pair(v); }; const again = screen.mode === "again"; return ( - - - {again - ? "This host no longer knows this browser — it was unpaired there. Enter the PIN it is showing to pair again." - : "Enter the PIN this host is showing. It is on the host's own screen, and it expires after a couple of minutes."} - - No PIN? Request access, and approve this browser in the host's console. + + {again ? m.browser_pair_again_body() : m.pair_intro_pin_only()} + {m.pair_no_pin_hint()} {/* The console's PIN readout, as a field: it is copied off another screen digit by digit, and a mistyped one costs a whole pairing window. `h-auto!` because the input's own `h-input-height` is a token tailwind-merge cannot see as a height. */} @@ -138,7 +126,7 @@ export function Pair({ screen, actions }: Props<"pair">): JSX.Element { maxLength={8} placeholder="0000" autoComplete="one-time-code" - aria-label="Pairing PIN" + aria-label={m.pair_pin()} disabled={!!screen.busy} className="h-auto! rounded-lg bg-muted/40 py-5 text-center font-mono text-4xl font-semibold tracking-[0.3em] tabular-nums placeholder:text-muted-foreground/30 md:text-4xl" value={pin} @@ -147,12 +135,12 @@ export function Pair({ screen, actions }: Props<"pair">): JSX.Element { /> {screen.error && } - + @@ -161,14 +149,11 @@ export function Pair({ screen, actions }: Props<"pair">): JSX.Element { export function Waiting({ screen, actions }: Props<"waiting">): JSX.Element { return ( - - - Approve “{screen.name}” in the console of {bare(screen.origin)}, under Pairing. The - stream starts as soon as you do. The request lapses after three minutes. - + + {m.dial_approve_no_pin({ host: bare(screen.origin) })} - + ); @@ -179,21 +164,14 @@ export function Waiting({ screen, actions }: Props<"waiting">): JSX.Element { // in the way of it — need different things from the person reading it. export function Trust({ screen, actions }: Props<"trust">): JSX.Element { return ( - - - Something is answering at {bare(screen.origin)}, but it cannot prove it is the machine - this browser paired with. - - - If you reinstalled punktfunk on it, or reset its configuration, that is expected — forget - this host and pair again. If you did not, stop here: something else is answering at that - address. - + + {m.browser_trust_body({ host: bare(screen.origin) })} + {m.browser_trust_advice()} {screen.reason} - + @@ -202,15 +180,19 @@ export function Trust({ screen, actions }: Props<"trust">): JSX.Element { export function LinkSheet({ screen, actions }: Props<"link">): JSX.Element { return ( - + - A link asks this browser to connect to {screen.address} - {screen.launch ? ` and start ${screen.launch}` : ""}. Only go ahead if you opened it - yourself. + {[ + m.link_confirm_asks({ host: screen.name, address: screen.address }), + screen.launch ? m.link_confirm_launch({ game: screen.launch }) : "", + m.link_confirm_guessable(), + ] + .filter(Boolean) + .join(" ")} - - + + ); @@ -221,8 +203,8 @@ export function ErrorCard({ screen, actions }: Props<"error">): JSX.Element { {screen.text} - - {screen.retry && } + + {screen.retry && } ); diff --git a/apps/web/src/ui/shell.tsx b/apps/web/src/ui/shell.tsx index 4159dbd..f0f5007 100644 --- a/apps/web/src/ui/shell.tsx +++ b/apps/web/src/ui/shell.tsx @@ -20,6 +20,7 @@ import { type JSX, useSyncExternalStore } from "react"; import { createRoot, type Root } from "react-dom/client"; import "../styles.css"; import { Stagger } from "@/components/stagger"; +import { m } from "../paraglide/messages.js"; import { Frame } from "./frame.tsx"; import { Home } from "./home.tsx"; import { Hud } from "./hud.tsx"; @@ -166,18 +167,18 @@ function Announce({ screen }: { screen: Screen }): JSX.Element { function announce(s: Screen): string { switch (s.kind) { - case "home": return s.error ? s.error : s.busy ? "Connecting" : `${s.hosts.length} known hosts`; - case "accept": return "This host's certificate must be accepted once"; - case "connecting": return `Connecting to ${s.origin}`; - case "pair": return s.error ?? "Enter the PIN this host is showing"; - case "waiting": return `Waiting for approval of ${s.name} in the host's console`; - case "profiles": return s.error ?? `Pick who is playing on ${s.host}`; + case "home": return s.error ? s.error : s.busy ? m.browser_announce_connecting_a11y() : m.browser_announce_hosts_a11y({ count: s.hosts.length }); + case "accept": return m.browser_announce_accept_a11y(); + case "connecting": return m.browser_announce_connecting_to_a11y({ host: s.origin }); + case "pair": return s.error ?? m.browser_announce_pair_a11y(); + case "waiting": return m.browser_announce_waiting_a11y({ name: s.name }); + case "profiles": return s.error ?? m.browser_announce_profiles_a11y({ host: s.host }); case "seat": return s.detail ? `${s.title} ${s.detail}` : s.title; - case "trust": return "This is not the host that was paired with"; - case "link": return `A link asks to connect to ${s.name}`; - case "library": return s.busy ? "Loading the library" : `${s.entries.length} titles`; - case "streaming": return "Streaming"; - case "settings": return "Settings"; + case "trust": return m.browser_announce_trust_a11y(); + case "link": return m.browser_announce_link_a11y({ name: s.name }); + case "library": return s.busy ? m.browser_announce_library_loading_a11y() : m.browser_announce_titles_a11y({ count: s.entries.length }); + case "streaming": return m.browser_announce_streaming_a11y(); + case "settings": return m.browser_announce_settings_a11y(); case "error": return `${s.head}. ${s.text}`; case "console": return ""; } From 4fef845abe42a1b170a14da67d0c217757b662dc Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Fri, 6 Nov 2026 22:53:13 +0100 Subject: [PATCH 07/13] feat(web): word the library from messages The library page, its empty and error states and the End game button read the shared messages. The title count is a plural message, and End game asks twice with the kit's own sentence instead of building one around the title. --- apps/web/src/ui/library.tsx | 55 +++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/apps/web/src/ui/library.tsx b/apps/web/src/ui/library.tsx index c70eaa2..80b2703 100644 --- a/apps/web/src/ui/library.tsx +++ b/apps/web/src/ui/library.tsx @@ -15,6 +15,7 @@ import { Card } from "@/components/ui/card"; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "@/components/ui/dialog"; import { Input } from "@/components/ui/input"; import { Spinner } from "@/components/ui/spinner"; +import { m } from "../paraglide/messages.js"; import { Body, PageHead } from "./frame.tsx"; import { Empty, ErrorLine, labelOf, Loading, status } from "./pieces.tsx"; import type { Actions, HostCard, Screen } from "./types.ts"; @@ -32,10 +33,10 @@ export function Library({ screen, actions }: { screen: LibraryScreen; actions: A if (screen.origin === null) { return ( - - -

Pair a host, and its games show up here.

- + + +

{m.lib_no_host_body()}

+
); @@ -44,9 +45,9 @@ export function Library({ screen, actions }: { screen: LibraryScreen; actions: A const q = query.trim().toLowerCase(); const shown = q ? screen.entries.filter((e) => e.title.toLowerCase().includes(q)) : screen.entries; const sub = screen.running - ? `Running now: ${screen.running}` + ? m.browser_lib_running_now({ title: screen.running }) : screen.entries.length - ? `${screen.entries.length} titles` + ? m.browser_lib_title_count({ count: screen.entries.length }) : undefined; return ( @@ -54,7 +55,7 @@ export function Library({ screen, actions }: { screen: LibraryScreen; actions: A - {screen.host ?? "Library"} + {screen.host ?? m.lib_title()} {screen.busy && screen.entries.length > 0 && } } @@ -63,10 +64,10 @@ export function Library({ screen, actions }: { screen: LibraryScreen; actions: A {screen.resume && ( )} - {screen.endable && screen.running && actions.endGame()} />} + {screen.endable && screen.running && actions.endGame()} />} {!screen.offline && ( + + ) : screen.error ? null : ( - This host's library is empty, or nothing has been added to it yet. + {m.lib_empty()} ) ) : shown.length === 0 ? ( - Nothing here matches “{query}”. + {m.lib_no_match_body({ query })} ) : ( )} @@ -165,14 +166,14 @@ function DesktopTile({ host, onPlay }: { host: HostCard; onPlay: () => void }): const state = status(host); return ( - @@ -203,7 +204,7 @@ function Grid({ entries, screen, actions }: { entries: LibraryEntry[]; screen: L )} - {running && Running} + {running && {m.lib_badge_running()}} {entry.title} @@ -264,13 +265,13 @@ function Tile({ entry, art, running, onPlay }: { entry: LibraryEntry; art: strin /** End the running title this device launched. It asks twice, as the dial does: unsaved progress * in the game is lost. */ -function EndGame({ title, onEnd }: { title: string; onEnd: () => void }): JSX.Element { +function EndGame({ onEnd }: { onEnd: () => void }): JSX.Element { const [armed, setArmed] = useState(false); return ( ); } From 0d9e55ef5374289b03c30868a7cbf582e5f16bfb Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Fri, 6 Nov 2026 22:53:13 +0100 Subject: [PATCH 08/13] feat(web): word the stream overlay from messages The toolbar, the quick actions menu and the statistics lines read the shared messages. The captured-mouse line puts the Esc key cap where the message places it, so a language can move it. --- apps/web/src/ui/hud.tsx | 91 +++++++++++++++++++++++++---------------- 1 file changed, 55 insertions(+), 36 deletions(-) diff --git a/apps/web/src/ui/hud.tsx b/apps/web/src/ui/hud.tsx index b1a676e..2c8c3e8 100644 --- a/apps/web/src/ui/hud.tsx +++ b/apps/web/src/ui/hud.tsx @@ -9,6 +9,7 @@ import { type JSX, type KeyboardEvent as ReactKeyboardEvent, useEffect, useState import { Badge, type BadgeVariant } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { Card } from "@/components/ui/card"; +import { m } from "../paraglide/messages.js"; import { bare } from "./pieces.tsx"; import type { Actions, Screen, SessionStats } from "./types.ts"; @@ -25,13 +26,16 @@ const RISE = { initial: { opacity: 0, y: 8 }, animate: { opacity: 1, y: 0 }, exi /** The connection dot is the wire's verdict, rated in core (`hud::quality`) from loss, repairs * and round trip. Presentation skips are the page's own pacing, not loss: they stay in the * overlay's skipped line. */ -const QUALITY: Record = { - starting: { variant: "outline", text: "starting" }, - good: { variant: "success", text: "good" }, - fair: { variant: "warning", text: "fair" }, - poor: { variant: "destructive", text: "poor" }, +const QUALITY: Record string }> = { + starting: { variant: "outline", text: () => m.browser_quality_starting() }, + good: { variant: "success", text: () => m.browser_quality_good() }, + fair: { variant: "warning", text: () => m.browser_quality_fair() }, + poor: { variant: "destructive", text: () => m.browser_quality_poor() }, }; +/** Stands where the key cap goes while the message is split around it. */ +const KEY_SLOT = "\uE000"; + export function Hud({ screen, actions }: { screen: Extract; actions: Actions }): JSX.Element { const [idle, setIdle] = useState(false); const stats = screen.stats; @@ -66,7 +70,7 @@ export function Hud({ screen, actions }: { screen: Extract actions.showDiagnostics(!screen.diagnostics)} > - {q.text} + {q.text()} {/* The one part that gives way on a phone. */} {bare(stats.origin)} @@ -91,21 +95,21 @@ export function Hud({ screen, actions }: { screen: Extract actions.toggleCapture()} > - -
@@ -147,7 +151,7 @@ export function Hud({ screen, actions }: { screen: Extract - Mouse captured — press Esc to release + )} @@ -155,7 +159,7 @@ export function Hud({ screen, actions }: { screen: Extract - Sound is off until you click or press a key. + {m.browser_sound_suspended()} )} @@ -198,7 +202,7 @@ function QuickMenu({ screen, actions }: { screen: Extract (armed ? actions.disconnect(true) : setArmed(true))} > - {armed ? "End stream? Press again" : "End stream"} + {armed ? m.ring_end_stream_confirm() : m.ring_end_stream()} {/* Only while this device's launch is on the stream: it closes the game, then the stream. */} {screen.endGame && ( @@ -220,15 +224,15 @@ function QuickMenu({ screen, actions }: { screen: Extract (endArmed ? actions.endGame() : setEndArmed(true))} > - {endArmed ? "End game? Press again" : "End game"} + {endArmed ? m.ring_end_game_confirm() : m.ring_end_game()} )}

- {tv ? "Back on the remote, or Back+A on a controller" : "Ctrl+Alt+Shift+O, or Back+A on a controller"} + {tv + ? m.browser_ring_menu_hint_tv({ remote: "Back", pad: "Back+A" }) + : m.browser_ring_menu_hint({ keys: "Ctrl+Alt+Shift+O", pad: "Back+A" })}

); } /** The microphone item's state, as the player reads it. */ -const MIC_STATE: Record, string> = { - off: "Off", - starting: "Asking…", - on: "On", - denied: "Blocked by the browser", - unsupported: "Not in this browser", +const MIC_STATE: Record, () => string> = { + off: () => m.browser_ring_mic_off(), + starting: () => m.browser_ring_mic_asking(), + on: () => m.ring_mic_on(), + denied: () => m.browser_ring_mic_blocked(), + unsupported: () => m.browser_ring_mic_unsupported(), }; /** How each overlay role reads: headline, breakdown, aside, warning. */ @@ -285,15 +291,15 @@ function Diagnostics({ stats: s, scale }: { stats: SessionStats; scale: number } const lines = s.hud ?? []; const browser = [ s.backend ?? "", - s.uploadMs ? `upload ${s.uploadMs.toFixed(2)} ms` : "", - `audio ${s.audio.state}`, - s.audio.underruns ? `${s.audio.underruns.toLocaleString()} underruns` : "", + s.uploadMs ? m.browser_overlay_upload({ value: `${s.uploadMs.toFixed(2)} ms` }) : "", + m.browser_overlay_audio({ state: s.audio.state }), + s.audio.underruns ? m.browser_overlay_underruns({ count: s.audio.underruns }) : "", ] .filter(Boolean) .join(" · "); return ( @@ -307,3 +313,16 @@ function Diagnostics({ stats: s, scale }: { stats: SessionStats; scale: number } ); } + +/** A message with a key cap in it: `text` was filled with `KEY_SLOT` where the cap goes, so a + * language can put the key anywhere in its sentence. */ +function Keyed({ text, cap }: { text: string; cap: string }): JSX.Element { + const [before = "", after = ""] = text.split(KEY_SLOT); + return ( + <> + {before} + {cap} + {after} + + ); +} From 469a746d3f0da7f9243c0ccd9f50fce915b27d9b Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Fri, 6 Nov 2026 22:53:13 +0100 Subject: [PATCH 09/13] feat(web): word the settings from messages Every row, hint and option reads the shared player-setting messages. The tabs have ids, so what the page remembers as the open tab is no longer its English label. Key chords are arguments of their messages. --- apps/web/src/ui/settings.tsx | 219 +++++++++++++++++++---------------- 1 file changed, 116 insertions(+), 103 deletions(-) diff --git a/apps/web/src/ui/settings.tsx b/apps/web/src/ui/settings.tsx index 037eeea..a270362 100644 --- a/apps/web/src/ui/settings.tsx +++ b/apps/web/src/ui/settings.tsx @@ -16,6 +16,7 @@ import { Input } from "@/components/ui/input"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; import { Slider } from "@/components/ui/slider"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; +import { m } from "../paraglide/messages.js"; import { Body, PageHead } from "./frame.tsx"; import type { Actions, Screen } from "./types.ts"; @@ -30,26 +31,33 @@ const RATES = [30, 60, 90, 120, 144, 165, 240]; /** Where the slider starts when Automatic is turned off. */ const FIXED_START_KBPS = 20_000; -const TABS = ["General", "Display", "Input", "Audio", "Controllers", "About"] as const; -type TabName = (typeof TABS)[number]; +const TABS = { + general: () => m.prefs_category_general(), + display: () => m.prefs_category_display(), + input: () => m.prefs_category_input(), + audio: () => m.prefs_category_audio(), + controllers: () => m.prefs_category_controllers(), + about: () => m.prefs_category_about(), +} as const; +type TabName = keyof typeof TABS; /** The tab last open, for the next time settings open this visit. */ -let lastTab: TabName = "General"; +let lastTab: TabName = "general"; /** What the page binds while streaming, as `pf_client_core::shortcuts` lists it for the console: * `input.ts` holds the bindings. The Samsung set adds the remote's Back, and has no Esc row * because Esc still reaches the host there. */ -const CONTROLS: ReadonlyArray = [ - ["Ctrl+Alt+Shift+Q", "Release the mouse, or capture it again"], - ["Esc", "Release the mouse, where the page captured it"], - ["Ctrl+Alt+Shift+D", "Disconnect"], - ["Ctrl+Alt+Shift+S", "Cycle the statistics overlay"], - ["Ctrl+Alt+Shift+O", "Open the quick actions menu"], - ["Ctrl+Alt+Shift+V", "Mute or unmute the microphone"], - ["Ctrl+Alt+Shift+M", "Switch the mouse mode"], - ["F11 or Alt+Enter", "Toggle fullscreen"], - ["Select + A", "Open the quick actions menu (controller)"], - ["L1 + R1 + Start + Select", "Release input; hold to disconnect (controller)"], +const CONTROLS: ReadonlyArray string]> = [ + ["Ctrl+Alt+Shift+Q", () => m.controls_release_mouse()], + ["Esc", () => m.controls_release_mouse_page()], + ["Ctrl+Alt+Shift+D", () => m.controls_disconnect()], + ["Ctrl+Alt+Shift+S", () => m.controls_cycle_stats()], + ["Ctrl+Alt+Shift+O", () => m.controls_open_menu()], + ["Ctrl+Alt+Shift+V", () => m.controls_toggle_mic()], + ["Ctrl+Alt+Shift+M", () => m.controls_switch_mouse_mode()], + [m.controls_either({ first: "F11", second: "Alt+Enter" }), () => m.controls_toggle_fullscreen()], + ["Select + A", () => m.browser_controls_open_menu_pad()], + ["L1 + R1 + Start + Select", () => m.browser_controls_release_pad()], ]; /** Set by `vite.config.ts` from `git describe`. */ @@ -58,7 +66,7 @@ declare const __PF_VERSION__: string; export function SettingsPage({ screen, actions }: { screen: SettingsScreen; actions: Actions }): JSX.Element { return ( - + ); @@ -71,12 +79,12 @@ export function SettingsDialog({ screen, actions }: { screen: SettingsScreen; ac { if (!open) actions.openSettings(false); }}> - Settings - Mouse, controller and statistics settings apply now; the rest take effect on the next stream. + {m.prefs_title()} + {m.browser_prefs_dialog_hint()} - + @@ -107,39 +115,44 @@ function SettingsTabs({ screen, actions }: { screen: SettingsScreen; actions: Ac className="flex flex-col gap-5" > - {TABS.map((t) => {t})} + {(Object.keys(TABS) as TabName[]).map((t) => {TABS[t]()})} - - + + set({ fullscreen: on })} /> - - + + set({ statsTier })} /> {!screen.streaming && ( - - - + + + )} set({ showAdvanced: on })} /> @@ -148,39 +161,39 @@ function SettingsTabs({ screen, actions }: { screen: SettingsScreen; actions: Ac ["advancedStats", "hudPlacement", "statsScalePct", "exitHint"], <> set({ advancedStats: on })} > - What each number means + {m.player_stats_docs_link()} - + set({ hudPlacement })} /> - + set({ exitHint: on })} /> @@ -188,47 +201,47 @@ function SettingsTabs({ screen, actions }: { screen: SettingsScreen; actions: Ac )} - - + + {v.width === 0 && ( set({ resizeStream: on })} /> )} - + - + set({ bitrateKbps: on ? 0 : FIXED_START_KBPS })} /> {v.bitrateKbps > 0 && ( `${n} Mbps`} + formatValue={(n) => m.common_mbits({ value: n })} onValueChange={(n) => set({ bitrateKbps: n * 1000 })} /> )} set({ hdr: on })} /> @@ -236,19 +249,19 @@ function SettingsTabs({ screen, actions }: { screen: SettingsScreen; actions: Ac {advanced( ["codec", "videoBackend"], <> - + set({ codec })} /> - + set({ videoBackend })} /> @@ -256,79 +269,79 @@ function SettingsTabs({ screen, actions }: { screen: SettingsScreen; actions: Ac )} - - + + set({ pointer })} /> - set({ invertScroll: on })} /> + set({ invertScroll: on })} /> set({ captureInput: on })} /> - - - set({ audio: on })} /> + + + set({ audio: on })} /> - - + + `${n}%`} + formatValue={(n) => m.common_percent({ value: n })} onValueChange={(n) => set({ deadzone: n / 100 })} /> - - - {(tizen() ? [["Back", "Open the quick actions menu"] as const, ...CONTROLS.filter(([k]) => k !== "Esc")] : CONTROLS).map( + + + {(tizen() ? [["Back", () => m.controls_open_menu()] as const, ...CONTROLS.filter(([k]) => k !== "Esc")] : CONTROLS).map( ([keys, text]) => ( - + {keys} ), )} - + {__PF_VERSION__} - + - The browser client guide + {m.browser_about_guide()} - + github.com/punktfunk/client-web - - + + @@ -353,9 +366,9 @@ function Resolution({ v, set }: { v: Settings; set: SetFn }): JSX.Element { }; return ( <> - + [String(i), a.label] as const)} onChange={(i) => { @@ -365,7 +378,7 @@ function Resolution({ v, set }: { v: Settings; set: SetFn }): JSX.Element { }} /> - + {custom && ( - +
{/* Keyed on the stored side, so a size the rule clamped shows what was kept. */} - typed(w, v.height)} /> + typed(w, v.height)} /> - typed(v.width, h)} /> + typed(v.width, h)} />
)} @@ -437,12 +450,12 @@ function Advanced({ onShow: () => void; children: ReactNode; }): JSX.Element | null { - if (show) return {children}; + if (show) return {children}; if (changed === 0) return null; return ( - - + + ); @@ -560,7 +573,7 @@ function Toggle({ onChange(v === "on")} />
From 9132764189b987eb143519a9b1a03ce47311e2f3 Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Fri, 6 Nov 2026 22:53:13 +0100 Subject: [PATCH 10/13] feat(web): word the page's own sentences from messages The error cards, link errors, wake and copy-link notices and the exit hint read the shared messages. The engine's reasons arrive in the page's language already; sentence() stays for the host's own English and for errors the browser raises, which are still fragments. --- apps/web/src/app.ts | 64 ++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/apps/web/src/app.ts b/apps/web/src/app.ts index 3eab219..48d2486 100644 --- a/apps/web/src/app.ts +++ b/apps/web/src/app.ts @@ -9,6 +9,7 @@ // hosts, trust, pairing and the session lives in the library, which is what lets the same engine // sit under a TV app without a line of this file. +import "./words.ts"; import { captureLog, Engine, @@ -46,6 +47,7 @@ import { } from "@punktfunk/stream"; import { type Configured, readConfig, type ServerConfig } from "./config.ts"; import { m } from "./paraglide/messages.js"; +import { apiText } from "./words.ts"; import { ConsoleUi } from "./ui/console.ts"; import { noop, WebShell } from "./ui/shell.tsx"; import type { HostCard, HostTools, ProfileCard, Screen, Tab, Ui } from "./ui/types.ts"; @@ -344,8 +346,8 @@ class App { case "unreachable": return this.show({ kind: "error", - head: "No answer", - text: `Nothing responded at ${bare(s.origin)}. Check the address, and that the host is running.`, + head: m.browser_no_answer_title(), + text: m.error_host_timeout(), retry: true, }); case "untrusted": @@ -374,7 +376,7 @@ class App { kind: "pair", origin: s.origin, mode: "first", - error: s.reason ? sentence(s.reason) : "That PIN was refused.", + error: s.reason ? sentence(s.reason) : m.pair_wrong_pin(), }); case "forgotten": return this.show({ kind: "pair", origin: s.origin, mode: "again" }); @@ -434,13 +436,11 @@ class App { return this.show({ kind: "error", head: s.skew - ? "This host speaks a different version" + ? m.browser_skew_title() : this.dropped ? "The stream stopped" - : "Something went wrong", - text: s.skew - ? `${sentence(s.message)} Update the host, or this page, so the two agree.` - : sentence(s.message), + : m.browser_error_title(), + text: s.skew ? `${sentence(s.message)} ${m.browser_skew_hint()}` : sentence(s.message), retry: !s.skew, }); } @@ -628,10 +628,10 @@ class App { if (parsed === null) return; history.replaceState(null, "", location.pathname + location.hash); if (typeof parsed === "string") { - return this.show({ kind: "error", head: "That link can't be used", text: LINK_ERRORS[parsed] }); + return this.show({ kind: "error", head: m.link_refused_title(), text: LINK_ERRORS[parsed]() }); } const found = this.resolveLink(parsed); - if (typeof found === "string") return this.show({ kind: "error", head: "That link can't be used", text: found }); + if (typeof found === "string") return this.show({ kind: "error", head: m.link_refused_title(), text: found }); const { target, name, address } = found; this.link = { target, ...(parsed.fp ? { fp: parsed.fp } : {}), ...(parsed.launch ? { launch: parsed.launch } : {}) }; this.show({ kind: "link", name, address, ...(parsed.launch ? { launch: parsed.launch } : {}) }); @@ -651,10 +651,10 @@ class App { } const byOrigin = all.find((h) => h.origin === origin || h.origin === link.host.replace(/\/+$/, "")); const byName = all.filter((h) => h.name?.toLowerCase() === link.host.toLowerCase()); - if (!byOrigin && byName.length > 1) return `More than one host here is called “${link.host}”.`; + if (!byOrigin && byName.length > 1) return m.link_ambiguous_host({ name: link.host }); const hit = byOrigin ?? byName[0]; if (hit) return { target: this.targetOf(hit.origin), name: hit.name ?? bare(hit.origin), address: bare(hit.origin) }; - if (!origin) return `“${link.host}” is not an address or a host this page knows.`; + if (!origin) return m.link_unknown_host({ name: link.host }); return { target: this.targetOf(link.host), name: link.name ?? bare(origin), address: bare(origin) }; } @@ -684,10 +684,10 @@ class App { const fingerprint = this.engine.knownHosts().find((h) => h.origin === origin)?.fingerprint; try { await navigator.clipboard.writeText(linkFor(location.href, origin, fingerprint)); - this.ui.notify(`Link to ${this.nameOf(origin)} copied.`); + this.ui.notify(m.hostcard_link_copied()); } catch (e) { console.warn("punktfunk: copy link", e); - this.ui.notify("Couldn't copy the link — the browser kept the clipboard.", "error"); + this.ui.notify(m.hostcard_link_copy_failed(), "error"); } } @@ -705,7 +705,7 @@ class App { try { const r = await serverFetch()(url, { method: "POST" }); if (r.status === 403 || r.status === 429) { - const why = r.status === 429 ? m.browser_too_many() : `Only a browser paired with ${this.nameOf(origin)} can wake it from this page.`; + const why = r.status === 429 ? m.browser_too_many() : m.browser_wake_unpaired({ host: this.nameOf(origin) }); this.ui.notify(why, "error"); return false; } @@ -717,11 +717,11 @@ class App { this.reachCache.set(origin, { reach: now, at: Date.now() }); up = now === "ok"; } - if (!up) this.ui.notify(`${this.nameOf(origin)} didn't answer within a minute of waking. It may still be starting.`, "error"); + if (!up) this.ui.notify(m.browser_wake_timeout({ host: this.nameOf(origin) }), "error"); return true; } catch (e) { console.warn("punktfunk: wake", e); - this.ui.notify(`Couldn't wake ${this.nameOf(origin)} — this page's server didn't send the wake packet.`, "error"); + this.ui.notify(m.browser_wake_failed({ host: this.nameOf(origin) }), "error"); return false; } finally { this.waking.delete(origin); @@ -763,8 +763,8 @@ class App { if (e instanceof VersionSkew) { return this.show({ kind: "error", - head: "This host speaks a different version", - text: `${sentence(e.message)} Update the host, or this page, so the two agree.`, + head: m.browser_skew_title(), + text: `${sentence(e.message)} ${m.browser_skew_hint()}`, }); } // The stream still works without a library, so this is a line on the page rather than a @@ -846,7 +846,7 @@ class App { ...(mine ? this.resumable() : {}), ...(mine && connected && this.running && this.runningEndable ? { endable: true } : {}), ...(mine && this.endNotice ? { notice: this.endNotice } : {}), - ...(mine && this.libraryError ? { error: `${sentence(this.libraryError)} You can still stream the desktop.` } : {}), + ...(mine && this.libraryError ? { error: m.browser_lib_load_failed_desktop({ why: sentence(this.libraryError) }) } : {}), }); void this.probe(shelves.map((h) => h.origin)); } @@ -880,7 +880,7 @@ class App { enabled: a.available && a.permitted, ...(a.available && a.permitted ? {} - : { reason: a.available ? "This device's access does not include it" : (a.unavailable_reason ?? "Not on this host") }), + : { reason: a.available ? "This device's access does not include it" : (apiText(a["unavailable_code"] as string | undefined, a["unavailable_params"] as Record | undefined, a.unavailable_reason) ?? "Not on this host") }), })), }); } catch (e) { @@ -1139,7 +1139,7 @@ class App { cards: gate.rows.map((p) => cardOf(p, this.pictures)), ...(saved ? { saved: saved.id } : {}), ...(decision?.gone ? { gone: decision.gone } : {}), - ...(listed === undefined ? { error: "Couldn't load the profiles." } : {}), + ...(listed === undefined ? { error: m.profile_load_failed() } : {}), }; this.gateShow(gate, picker); void this.readPictures(gate, picker); @@ -1213,7 +1213,7 @@ class App { } private gateFailed(gate: Gate, line: string): void { - this.gateShow(gate, { kind: "error", head: "Couldn't start the stream", text: sentence(line) }); + this.gateShow(gate, { kind: "error", head: m.browser_gate_failed_title(), text: sentence(line) }); } private cancelGate(): void { @@ -1296,12 +1296,12 @@ function readShelf(): string | null { } /** Why a link was refused, as a sentence. */ -const LINK_ERRORS: Record, PageLink | null>, string> = { - "missing-host": "It does not say which host to connect to.", - "too-long": "One of its parts is longer than a real link's.", - "control-char": "It carries characters no real link does.", - "bad-fingerprint": "Its host fingerprint is not one.", - "bad-launch": "Its game id is not a valid one.", +const LINK_ERRORS: Record, PageLink | null>, () => string> = { + "missing-host": () => m.link_error_missing_host_ref(), + "too-long": () => m.link_error_too_long(), + "control-char": () => m.link_error_malformed(), + "bad-fingerprint": () => m.link_error_bad_fingerprint(), + "bad-launch": () => m.link_error_bad_launch_id(), }; /** The engine speaks in lowercase fragments, as logs do; a screen speaks in sentences. */ @@ -1416,7 +1416,7 @@ const EXIT_HINT_MS = 6000; /** How to leave with the input in hand: the pad chord with a controller connected, the dial's * End stream on a touchscreen, the key otherwise. */ function exitHintText(): string { - if (navigator.getGamepads?.().some((g) => g?.mapping === "standard")) return "Hold L1 + R1 + Start + Select to leave"; - if (matchMedia("(pointer: coarse)").matches) return "Menu, then End stream, to leave"; - return "Ctrl+Alt+Shift+D to leave"; + if (navigator.getGamepads?.().some((g) => g?.mapping === "standard")) return m.notice_exit_hold({ keys: "L1 + R1 + Start + Select" }); + if (matchMedia("(pointer: coarse)").matches) return m.browser_exit_menu(); + return m.notice_exit_keys({ keys: "Ctrl+Alt+Shift+D" }); } From b394d548838f04adbb4d671f63a925f33ed35bdb Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Fri, 6 Nov 2026 22:53:18 +0100 Subject: [PATCH 11/13] feat(web): pass the browser's languages to the console The console on the canvas picks its own language from the list it is given. The browser's list is the page's only language signal, most preferred first, so it goes in as it is. The page has no setting for it. --- apps/web/src/ui/console.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/web/src/ui/console.ts b/apps/web/src/ui/console.ts index 201679f..204756c 100644 --- a/apps/web/src/ui/console.ts +++ b/apps/web/src/ui/console.ts @@ -340,6 +340,8 @@ export class ConsoleUi implements Ui { // Answers `FetchProfiles`, so a connect picks the profile and readies its seat first. profiles: true, settings: this.startSettings(), + // The browser's own list, most preferred first: the console words itself in the first it ships. + languages: [...navigator.languages], }); if (!this.started) { console.error("punktfunk: the console could not start; the web shell stays up"); From afd99f8a0fa0ee4bbae85ab4c2f4a36e715783c2 Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Fri, 6 Nov 2026 22:53:18 +0100 Subject: [PATCH 12/13] feat(web): word the console's library error from a message The console's library error card carried an English title that the page supplied. It reads the shared message the other clients show. --- apps/web/src/ui/console.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/web/src/ui/console.ts b/apps/web/src/ui/console.ts index 204756c..e8086ea 100644 --- a/apps/web/src/ui/console.ts +++ b/apps/web/src/ui/console.ts @@ -36,6 +36,7 @@ import { tizen, tvBack, } from "@punktfunk/stream"; +import { m } from "../paraglide/messages.js"; import { FrameMeter, type Row, type Step, Sweep, table } from "./console-cost.ts"; import { hostRow, originFor } from "./console-hosts.ts"; import { coverBytes } from "./cover.ts"; @@ -744,7 +745,7 @@ export class ConsoleUi implements Ui { this.gamesSent = sig; if (s.error) { this.pushLibrary(CONSOLE_PUSH.LIBRARY_PHASE, "phase", { - Error: { title: "The library could not be read", body: s.error, can_retry: true }, + Error: { title: m.lib_load_failed(), body: s.error, can_retry: true }, }); } else if (s.entries.length === 0) { this.pushLibrary(CONSOLE_PUSH.LIBRARY_PHASE, "phase", s.busy ? "Loading" : "Empty"); From 49bf322de8382f1de04164140ce519ebda979ebe Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Fri, 6 Nov 2026 22:54:10 +0100 Subject: [PATCH 13/13] docs(web): say where the page's words come from The messages are not in this repo, and the app's scripts now need cargo and the pinned checkout to copy them. A reader who hits that on a fresh clone should find it in the Build section. --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 7e04702..b148322 100644 --- a/README.md +++ b/README.md @@ -173,6 +173,12 @@ Four tools, each for what it is for, in this order: 4. **Vite** builds the app from source — the library through a workspace alias, the SDK, Effect — and turns the library's wasm reference into an emitted asset. +The page's words are not in this repo. They are the pinned monorepo's `l10n/messages`, which +`scripts/l10n-messages.mjs` finds through cargo and copies into `apps/web/l10n/` before the app's +`dev`, `check`, `test` and `build` run, so those need the Rust toolchain and the checkout cargo +fetches for the pin. The page follows the browser's language list, and a language shows once the +pinned monorepo ships it. + For development against a real host without accepting its certificate first, build the debug module once (`packages/stream/build.sh`, seconds to relink) and run the dev server: