hypeframe 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SairiDev
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,335 @@
1
- # Temporary Holding Version
1
+ <p align="center">
2
+ <b>◆ hypeframe</b><br>
3
+ The local engine for <a href="https://hype-frame.com">HypeFrame Web</a>.<br>
4
+ Code clips, video renders and (soon) AI assistants run on your own machine. The web is just the screen.
5
+ </p>
2
6
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
7
+ <p align="center">
8
+ <a href="https://www.npmjs.com/package/hypeframe"><img alt="npm" src="https://img.shields.io/npm/v/hypeframe?color=3DD6C3&label=npm"></a>
9
+ <a href="LICENSE"><img alt="MIT" src="https://img.shields.io/badge/license-MIT-3DD6C3"></a>
10
+ <a href="README.id.md"><img alt="Bahasa Indonesia" src="https://img.shields.io/badge/baca-Bahasa%20Indonesia-B49CFF"></a>
11
+ </p>
12
+
13
+ ```bash
14
+ npx hypeframe
15
+ ```
16
+
17
+ > **Preview.** HypeFrame Web is opening in stages. The protocol and commands may still change before 1.0.
18
+
19
+ ## Contents
20
+
21
+ - [How it works](#how-it-works)
22
+ - [Install](#install)
23
+ - [Quick start](#quick-start)
24
+ - [Commands](#commands)
25
+ - [Rendering](#rendering)
26
+ - [Security and privacy](#security-and-privacy)
27
+ - [Data folder](#data-folder)
28
+ - [Troubleshooting](#troubleshooting)
29
+ - [Development](#development)
30
+ - [License](#license)
31
+
32
+ ## How it works
33
+
34
+ ```
35
+ Your browser (phone / PC) HypeFrame servers Your machine
36
+ ┌──────────────────────────┐ ┌──────────────────────────┐ ┌──────────────────────────────┐
37
+ │ HypeFrame Web │◄───►│ Gateway │◄────│ hypeframe (local engine) │
38
+ │ editor, preview, │ WS │ accounts, device list, │ WS │ (connects out to the gateway,│
39
+ │ projects saved in the │ │ relays control messages │ │ never opens a port) │
40
+ │ browser │ └──────────────────────────┘ │ headless Chrome + ffmpeg │
41
+ │ │◄────────── http://127.0.0.1 ─────────│ local render service │
42
+ └──────────────────────────┘ project files and finished video └──────────────────────────────┘
43
+ go direct, never through a server
44
+ ```
45
+
46
+ - **Connection.** The engine opens an outgoing connection to the HypeFrame gateway. No port forwarding, no router setup.
47
+ - **Only small messages pass the gateway**, such as "status" and "give me a render key".
48
+ - **Files never touch a server.** Projects and results move between the browser and the engine over `127.0.0.1` on
49
+ the same machine.
50
+ - **Same motion engine everywhere.** Renders use the same motion engine as the HypeFrame phone app and the render
51
+ server, so the output matches.
52
+
53
+ ## Install
54
+
55
+ | | |
56
+ |---|---|
57
+ | Node.js | 20.3 or newer ([download](https://nodejs.org)) |
58
+ | System | Windows 10/11, macOS, Linux (x64 or arm64) |
59
+ | Android | Through Termux (`pkg install nodejs`). Rendering needs Chromium; the HypeFrame app (APK) is the easier route. |
60
+ | iPhone / iPad | Cannot run the engine. Use HypeFrame Web with "In this browser" rendering. |
61
+ | Chrome | Uses the installed Chrome or Edge. Without one, Chrome for Testing is downloaded once (about 150 MB). |
62
+ | RAM | 8 GB or more for 1080p video. 4 GB is enough for small videos. |
63
+
64
+ Run it once without installing:
65
+
66
+ ```bash
67
+ npx hypeframe
68
+ ```
69
+
70
+ Or install it so `hypeframe` is always there (needed for **Start automatically**):
71
+
72
+ ```bash
73
+ npm i -g hypeframe
74
+ ```
75
+
76
+ ```powershell
77
+ # Windows, with a check for Node.js first
78
+ irm https://raw.githubusercontent.com/sairidev/hypeframe/main/install.ps1 | iex
79
+ ```
80
+
81
+ ```bash
82
+ # macOS / Linux, with a check for Node.js first
83
+ curl -fsSL https://raw.githubusercontent.com/sairidev/hypeframe/main/install | bash
84
+ ```
85
+
86
+ ## Quick start
87
+
88
+ 1. Open [HypeFrame Web](https://hype-frame.com) and sign in with Google.
89
+ 2. On the machine that will do the work, open a terminal and run `hypeframe` (or `npx hypeframe`).
90
+
91
+ ```
92
+ ◆ hypeframe v0.2.0
93
+ local engine for HypeFrame Web
94
+
95
+ Account ▲ not connected
96
+ Engine stopped
97
+ Device LAPTOP-RAFI (windows)
98
+ Render Chrome · GPU off
99
+ 24 hours -
100
+ Version 0.2.0 · Node 22.15.0
101
+
102
+ ◆ What would you like to do?
103
+ │ ● Start the engine (connects your account first)
104
+ │ ○ Open HypeFrame Web
105
+ │ ○ Render speed test
106
+ │ ○ Render history
107
+ │ ○ ✦ AI assistant on this machine (coming soon)
108
+ │ ○ Start automatically
109
+ │ ○ Settings
110
+ │ ○ Check this machine
111
+ │ ○ Free up space
112
+ │ ○ Create a problem report
113
+ │ ○ Update hypeframe
114
+ │ ○ Connect to an account
115
+ │ ○ Exit
116
+ └
117
+ ```
118
+
119
+ 3. Pick **Start the engine**. It prints a code and a link and opens your browser:
120
+
121
+ ```
122
+ 16:03:20 ● Open https://hype-frame.com/sambung?kode=KJ4M-7QXP and press Connect. Code: KJ4M-7QXP
123
+ ```
124
+
125
+ 4. Check the device name on that page and press **Connect**.
126
+
127
+ ```
128
+ 16:03:31 ✔ Connected to account r***@gmail.com
129
+ 16:03:32 ✔ Engine ready. Keep this window open while you use HypeFrame Web.
130
+ 16:03:32 ↳ Press Ctrl+C to stop.
131
+ 16:03:36 ✔ Render ready (Chrome 131.0.6778.86).
132
+ ```
133
+
134
+ Keep the window open. HypeFrame Web shows **"Engine: LAPTOP-RAFI · connected"** in the corner. Next time just run
135
+ `hypeframe` again; a connected device does not need a new code.
136
+
137
+ The terminal speaks Indonesian when your system does and English otherwise. Pin it with
138
+ `hypeframe config --language id|en|auto` or `HYPEFRAME_LANG`.
139
+
140
+ ## Commands
141
+
142
+ `hypeframe` with no command opens the menu in a terminal. Outside a terminal (services, autostart, CI) it starts the
143
+ engine directly. Every menu item is also a command:
144
+
145
+ | Command | What it does |
146
+ |---|---|
147
+ | `hypeframe start` | Start the engine; connects the account first when needed |
148
+ | `hypeframe login` | Connect this device to a HypeFrame account |
149
+ | `hypeframe logout` | Remove the device token from this machine (`keluar` also works). To revoke it from the account side, use **Disconnect** on the web |
150
+ | `hypeframe status` | Account, engine, render, version |
151
+ | `hypeframe open` | Open HypeFrame Web in the browser |
152
+ | `hypeframe doctor` | Check Node, disk space, ffmpeg, Chrome and its encoders, gateway and web |
153
+ | `hypeframe bench` | Measure H.264 encoding at 720p and 1080p in the render Chrome; estimates a 60-second video |
154
+ | `hypeframe history` | Renders from the last 24 hours, with file paths |
155
+ | `hypeframe autostart on\|off` | Start the engine when you sign in (Startup folder / LaunchAgent / systemd user unit) |
156
+ | `hypeframe config` | Device name, GPU, language; interactive in a terminal |
157
+ | `hypeframe clean` | Remove the downloaded Chrome, cached render pages, old logs and failed renders. Finished videos stay |
158
+ | `hypeframe report` | Write a problem report (versions, settings, recent log) with tokens masked |
159
+ | `hypeframe update` | `npm i -g hypeframe@latest` |
160
+
161
+ | Option | Meaning |
162
+ |---|---|
163
+ | `--gpu` / `--no-gpu` | Render with the device GPU: faster for heavy WebGL. Without it, renders use SwiftShader like the render server, so output matches exactly |
164
+ | `--name <name>` | Device name shown on the web (default: computer name, up to 40 characters) |
165
+ | `--no-browser` | Do not open a browser while connecting; the link is still printed. For headless servers |
166
+ | `--language id\|en\|auto` | Terminal language (with `config`) |
167
+ | `--gateway <url>` | Gateway address (default `https://api.sairipedia.com`) |
168
+ | `--web <url>` | HypeFrame Web address (default `https://hype-frame.com`). The render page comes from here, and only this origin may use the local render service |
169
+
170
+ The 0.1.0 spellings `--nama` and `--tanpa-browser` still work.
171
+
172
+ | Environment variable | Meaning |
173
+ |---|---|
174
+ | `HYPEFRAME_GATEWAY_URL`, `HYPEFRAME_WEB_URL` | Same as `--gateway`, `--web` |
175
+ | `HYPEFRAME_DIR` | Data folder (default `~/.hypeframe`) |
176
+ | `HYPEFRAME_CHROME` | A specific Chrome binary instead of the automatic search |
177
+ | `HYPEFRAME_LANG` | `id` or `en` |
178
+ | `NO_COLOR`, `FORCE_COLOR` | Turn terminal colors off or on |
179
+
180
+ One data folder runs one engine at a time. A second copy stops with "The engine is already running in another
181
+ terminal."
182
+
183
+ ### Managing devices
184
+
185
+ **Settings → My devices** on HypeFrame Web lists each device with its name, system, status, engine version and render
186
+ readiness. You can **rename** it, **make it primary** (used when several are connected) or **disconnect** it (the token
187
+ is revoked and the engine on that machine stops at once). An account can have up to **5 devices**. Engines that are too
188
+ old are marked **Needs update**: run `hypeframe update` or `npx hypeframe@latest`.
189
+
190
+ ## Rendering
191
+
192
+ **What runs on the engine:** saving videos when "On my engine" is selected, and code clips (engine first, then the
193
+ render server on the Max plan, then the browser).
194
+
195
+ **One render, step by step**
196
+
197
+ 1. The web asks the engine for a render key through the gateway, then sends the project straight to
198
+ `http://127.0.0.1:<port>` in 8 MB parts, each with a sha256 digest.
199
+ 2. The engine starts headless Chrome with a fresh profile and loads the HypeFrame render page. The page comes from
200
+ HypeFrame Web and is cached per version; rarely used files such as fonts and effects are fetched on demand.
201
+ 3. The MP4 (H.264) goes back to the browser. Transparent clips become WebM.
202
+
203
+ **Limits:** one render at a time (others queue), 30 minutes per render, results kept 24 hours. **Transparent clips**
204
+ need a Chrome that can encode VP9 with alpha. Headless Chrome on Windows cannot, so the engine refuses those quickly and
205
+ the web makes them elsewhere; the terminal says so when the engine starts.
206
+
207
+ ## Security and privacy
208
+
209
+ - **Allowed messages only.** The engine accepts `status` and `kunci` (render key) and nothing else. The gateway filters
210
+ too, but the engine never relies on that, so a server cannot make the engine run arbitrary commands. There is no
211
+ remote terminal.
212
+ - **Local render service** listens on `127.0.0.1` only. CORS is limited to the HypeFrame Web origin, with Chrome's
213
+ local network access permission. Every render needs a ticket signed (HMAC-SHA256) with a random key made each time
214
+ the engine starts; the key is only handed, through the gateway, to tabs signed in as the engine's owner.
215
+ - **The render Chrome has no internet.** Every host name resolves to nothing except `127.0.0.1`, so code inside a clip
216
+ cannot send data out.
217
+ - **Device token** (`hfm_…`) lives in `~/.hypeframe/akun.json`, readable by the owner only. It is never printed, and is
218
+ masked in the log file and problem reports. The gateway stores only its sha256.
219
+ - **Phishing codes.** Never approve a code you did not run yourself. When a code was requested from a different
220
+ network than your browser, the approval page shows a warning.
221
+ - **Sent to the server:** device name, operating system, engine version, render capabilities and the local port.
222
+ Projects and videos are not.
223
+
224
+ Found a vulnerability? See [SECURITY.md](SECURITY.md).
225
+
226
+ ## Data folder
227
+
228
+ ```
229
+ ~/.hypeframe/
230
+ ├── akun.json device token (owner-readable only)
231
+ ├── settings.json name, GPU, language, addresses
232
+ ├── mesin.kunci one engine per folder
233
+ ├── log/hypeframe.log plain-text log, tokens masked (rotated at 1 MB)
234
+ ├── cache/
235
+ │ ├── chrome/ Chrome for Testing (when downloaded)
236
+ │ └── halaman/<ver>/ render page from HypeFrame Web (last 2 versions)
237
+ └── kerja/render/ render jobs and results (removed automatically)
238
+ ```
239
+
240
+ To remove everything: press **Disconnect** on the web, then delete `~/.hypeframe`.
241
+
242
+ ## Troubleshooting
243
+
244
+ Start with `hypeframe doctor`: it checks everything the engine needs and says what blocks rendering.
245
+
246
+ | Symptom | Cause and fix |
247
+ |---|---|
248
+ | `npx` not found | Node.js is missing or too old. Install Node.js 20.3+ |
249
+ | "Gateway unreachable. Retrying..." | Internet or server trouble. The engine keeps retrying |
250
+ | "The code expired" | Codes last 10 minutes. Run `hypeframe` again |
251
+ | "This account already has 5 devices" | Disconnect one under **My devices** |
252
+ | The web shows "disconnected" | The engine window closed, the computer slept or the internet dropped. Run it again; it also reconnects by itself |
253
+ | "Rendering is not available yet: …" | Chrome or the render page is not ready. The engine retries every 10 minutes. Check the internet or set `HYPEFRAME_CHROME` |
254
+ | Web: "the engine cannot be reached from this browser" | The web is open on another device, or local network access was denied. Open the web on the same machine and allow access. The video is made in the browser meanwhile |
255
+ | "Transparent clips are made elsewhere" | This Chrome has no VP9 alpha. Transparent clips are made on the server or in the browser |
256
+ | "This engine is too old" | `hypeframe update` or `npx hypeframe@latest` |
257
+ | "already connected from another window or computer" | The same token is in use elsewhere. Close one of them |
258
+ | A 1080p render fails with "Encoding error." | Not enough memory. Close other apps, or choose the **Saver** quality |
259
+
260
+ Still stuck? Run `hypeframe report` and send the file to the HypeFrame team.
261
+
262
+ ## Development
263
+
264
+ This repository is a small monorepo in the style of [OpenCode](https://opencode.ai): TypeScript, Bun for
265
+ tooling, and a package that runs on plain Node.js.
266
+
267
+ ```
268
+ packages/
269
+ ├── hypeframe/ the npm package
270
+ │ ├── bin/hypeframe.js entry: checks the Node version, loads dist/index.js
271
+ │ ├── src/
272
+ │ │ ├── index.ts arguments → command or menu
273
+ │ │ ├── cli/ menu.ts, args.ts, commands/*.ts
274
+ │ │ ├── engine/ pairing.ts, connection.ts, handler.ts
275
+ │ │ ├── render/ service.ts, job.ts, chrome.ts, page.ts
276
+ │ │ ├── config/ paths, account, lock, settings, version
277
+ │ │ ├── ui/ theme (colors), log, banner, locale (id/en)
278
+ │ │ └── util/ open, format
279
+ │ └── test/ node:test suites (run through tsx)
280
+ └── protocol/ message shapes, close codes, ticket format, error texts shared with the web
281
+ script/build.ts Bun.build → packages/hypeframe/dist/index.js
282
+ script/release.ts typecheck, test, build, npm publish (dry run unless --publish)
283
+ install, install.ps1 installers
284
+ ```
285
+
286
+ ```bash
287
+ npm install # or: bun install
288
+ npm run dev -- status # run from source (tsx)
289
+ npm run typecheck
290
+ npm test # unit tests + the render service with a fake renderer
291
+ HF_TEST_CHROME=1 npm test # plus a real render in Chrome (needs HF_DIST_RENDER=<dist-render folder>)
292
+ npm run build # Bun bundles src into dist (bun comes as a dev dependency)
293
+ ```
294
+
295
+ See [CONTRIBUTING.md](CONTRIBUTING.md) and [AGENTS.md](AGENTS.md).
296
+
297
+ ### Protocol (version 1)
298
+
299
+ Engine ↔ gateway over `wss://<gateway>/mesin/ws`. Wire names are Indonesian because that is what the deployed gateway
300
+ and web speak; [`packages/protocol`](packages/protocol/src/index.ts) documents them in English.
301
+
302
+ | Direction | Message |
303
+ |---|---|
304
+ | engine → gateway | `{t:'halo', token, protokol:1, versi, os, nama, kemampuan:{render, chrome, transparan}, portLokal}` |
305
+ | gateway → engine | `{t:'ok', id}`, or close `4001` (bad hello), `4011` (token revoked), `4012` (other protocol), `4002` (replaced) |
306
+ | gateway → engine | `{t:'perintah', dari, id, jenis, ...}` |
307
+ | engine → gateway | `{t:'balas', ke, id, ok, ...}` to the asking tab, or `{t:'kabar', jenis, ...}` to every tab of the account |
308
+
309
+ Messages are at most 256 KB; an engine sends at most 300 messages a minute.
310
+
311
+ **Local render API** (`http://127.0.0.1:<port>`, `Authorization: Bearer v1.<body>.<HMAC>`)
312
+
313
+ | Route | Purpose |
314
+ |---|---|
315
+ | `POST /tugas` | create a job |
316
+ | `PUT /tugas/:job/potongan/:n` | a ZIP package part, header `x-sha256` |
317
+ | `POST /tugas/:job/mulai` | `{jumlah, ukuran, sha256}` |
318
+ | `GET /tugas/:job` | status |
319
+ | `GET /tugas/:job/hasil` | the MP4/WebM, supports `Range` |
320
+ | `DELETE /tugas/:job` | cancel |
321
+
322
+ A package holds `klip.json` (`{klip}`) or `proyek.json` (`{proyek, setelan}`), plus `aset/<id>`.
323
+
324
+ ## License
325
+
326
+ [MIT](LICENSE) for the code in this repository. Installed dependencies carry their own licenses:
327
+
328
+ | Package | License |
329
+ |---|---|
330
+ | `ws`, `yauzl`, `picocolors`, `@clack/prompts` | MIT |
331
+ | `puppeteer-core`, `@puppeteer/browsers` | Apache-2.0 |
332
+ | `ffmpeg-static` | GPL-3.0-or-later (the package and the ffmpeg binary it downloads) |
333
+
334
+ Chrome for Testing is downloaded from Google under Google's terms. The HypeFrame render page (including Remotion and
335
+ GSAP) is **not** in this package; it is fetched from HypeFrame Web when used and follows its own licenses.
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+ // Entry point installed as `hypeframe`. Checks the Node version before loading the bundle so old Node gets a clear
3
+ // message instead of a syntax error.
4
+ const [major, minor] = process.versions.node.split('.').map(Number);
5
+ if (major < 20 || (major === 20 && minor < 3)) {
6
+ console.error(`hypeframe needs Node.js 20.3 or newer (this is ${process.versions.node}). https://nodejs.org`);
7
+ process.exit(1);
8
+ }
9
+ await import('../dist/index.js');