@tomorrowos/sdk 0.9.57 → 0.9.58
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/VERCEL_QUESTIONS.md +1 -1
- package/VERCEL_SETUP.md +2 -2
- package/dist/chunked-upload.js +1 -1
- package/dist/tomorrowos.d.ts.map +1 -1
- package/dist/tomorrowos.js +41 -2
- package/package.json +1 -1
- package/templates/cms-starter/package.json +2 -2
- package/templates/cms-starter/public/methods.js +2 -21
- package/templates/cms-starter-v0/cms-panel/methods.js +2 -21
- package/templates/cms-starter-v0/package.json +2 -2
package/VERCEL_QUESTIONS.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Vercel / v0 ? Verbatim question bank
|
|
2
2
|
|
|
3
|
-
> **Protocol:** `vercel-questions/1.1` (pairs with `VERCEL_SETUP.md` 1.10+ / `@tomorrowos/sdk` 0.9.
|
|
3
|
+
> **Protocol:** `vercel-questions/1.1` (pairs with `VERCEL_SETUP.md` 1.10+ / `@tomorrowos/sdk` 0.9.58+)
|
|
4
4
|
> **For Agents:** When asking the user a setup question, **copy-paste the block below for that step EXACTLY**.
|
|
5
5
|
> Do **not** paraphrase, reorder, rename options, or invent alternatives (no S3, no Supabase Storage, no "Blob recommended", no "disable media").
|
|
6
6
|
> After each answer, configure per `VERCEL_SETUP.md`, then paste the **next** block.
|
package/VERCEL_SETUP.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
>
|
|
6
6
|
> **On Vercel, this file is the setup questionnaire** (not `REPLIT_SETUP.md`).
|
|
7
7
|
>
|
|
8
|
-
> Protocol id: `vercel-setup/1.9` ? pairs with `@tomorrowos/sdk` **0.9.
|
|
8
|
+
> Protocol id: `vercel-setup/1.9` ? pairs with `@tomorrowos/sdk` **0.9.58+** (`templates/cms-starter-v0`, Fluid Functions WebSockets).
|
|
9
9
|
>
|
|
10
10
|
> **Questions source of truth:** `VERCEL_QUESTIONS.md` ? Agents must **open that file and paste each Q block verbatim**. Do not paraphrase.
|
|
11
11
|
> **Copy questions verbatim from `VERCEL_QUESTIONS.md`.** Do not invent alternate Q2 options (no ?Supabase Storage?? no S3, no ?disable media?? no making Blob the recommended option).
|
|
@@ -39,7 +39,7 @@ Open VERCEL_QUESTIONS.md first.
|
|
|
39
39
|
For Q1, Q2, Q3: paste each question block VERBATIM. Do not rephrase options.
|
|
40
40
|
After Q1 database choice, YOU set TOMORROWOS_STORE and DATABASE_SSL. Do not ask me to fill those.
|
|
41
41
|
After Q2 media storage choice, YOU set TOMORROWOS_MEDIA. Do not ask me to fill those.
|
|
42
|
-
Run: npx @tomorrowos/sdk@0.9.
|
|
42
|
+
Run: npx @tomorrowos/sdk@0.9.58 init . --hosting v0 --force
|
|
43
43
|
Keep cms-starter-v0 layout.
|
|
44
44
|
Apply the NON-NEGOTIABLE VERCEL RUNTIME CONTRACT exactly:
|
|
45
45
|
one TomorrowOS instance only
|
package/dist/chunked-upload.js
CHANGED
|
@@ -2,7 +2,7 @@ import { createHash, randomUUID } from "crypto";
|
|
|
2
2
|
import fs from "fs/promises";
|
|
3
3
|
import path from "path";
|
|
4
4
|
/** Keep each proxy request well under typical host/body limits (Replit 413). */
|
|
5
|
-
export const MEDIA_UPLOAD_CHUNK_BYTES =
|
|
5
|
+
export const MEDIA_UPLOAD_CHUNK_BYTES = 1 * 1024 * 1024;
|
|
6
6
|
const UPLOAD_ID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
7
7
|
export function isValidUploadId(uploadId) {
|
|
8
8
|
return UPLOAD_ID_RE.test(String(uploadId || "").trim());
|
package/dist/tomorrowos.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tomorrowos.d.ts","sourceRoot":"","sources":["../src/tomorrowos.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ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
|
|
6
|
+
import { fileURLToPath } from "url";
|
|
6
7
|
import { WebSocket, WebSocketServer } from "ws";
|
|
7
8
|
import { generateDeterministicPairingCode, generateRandomPairingCode, isValidPairingCodeFormat, normalizePairingCode, resolvePairingCodeSecret } from "./pairing-code.js";
|
|
8
9
|
import { PlaylistCatalog } from "./playlist-catalog.js";
|
|
@@ -18,6 +19,14 @@ import { buildServerStatus } from "./server-status.js";
|
|
|
18
19
|
/** Mark offline if no device.ping within this window (power-loss / half-open TCP). */
|
|
19
20
|
const DEVICE_HEARTBEAT_TIMEOUT_MS = 30_000;
|
|
20
21
|
const DEVICE_HEARTBEAT_SWEEP_MS = 10_000;
|
|
22
|
+
function sdkPackageRoot() {
|
|
23
|
+
return path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
24
|
+
}
|
|
25
|
+
/** Project methods.js without chunked upload still hits host 413 on large files. */
|
|
26
|
+
function methodsJsSupportsChunkedUpload(source) {
|
|
27
|
+
return (source.includes("uploadViaChunkedProxy") &&
|
|
28
|
+
source.includes("/media/upload-init"));
|
|
29
|
+
}
|
|
21
30
|
function normalizeDevicePlatform(platform, system) {
|
|
22
31
|
const explicit = typeof platform === "string" ? platform.trim().toLowerCase() : "";
|
|
23
32
|
if (explicit)
|
|
@@ -942,6 +951,18 @@ export class TomorrowOS extends EventEmitter {
|
|
|
942
951
|
return;
|
|
943
952
|
}
|
|
944
953
|
try {
|
|
954
|
+
const declaredLength = Number(req.headers["content-length"]);
|
|
955
|
+
if (Number.isFinite(declaredLength) &&
|
|
956
|
+
declaredLength > MEDIA_UPLOAD_CHUNK_BYTES) {
|
|
957
|
+
// Avoid buffering a huge body that many hosts (e.g. Replit) reject with 413.
|
|
958
|
+
req.resume();
|
|
959
|
+
sendJson(res, 413, {
|
|
960
|
+
status: "failed",
|
|
961
|
+
code: "USE_CHUNKED",
|
|
962
|
+
error: "File too large for single-request upload. Soft-refresh the Control Panel (SDK serves chunked methods.js) or copy templates/.../methods.js, then retry."
|
|
963
|
+
});
|
|
964
|
+
return;
|
|
965
|
+
}
|
|
945
966
|
const body = await readRawBody(req, MAX_MEDIA_UPLOAD_BYTES);
|
|
946
967
|
if (body.length === 0) {
|
|
947
968
|
sendJson(res, 400, { status: "failed", error: "Empty upload body" });
|
|
@@ -1355,7 +1376,21 @@ export class TomorrowOS extends EventEmitter {
|
|
|
1355
1376
|
return false;
|
|
1356
1377
|
}
|
|
1357
1378
|
try {
|
|
1358
|
-
|
|
1379
|
+
let buf = await fs.readFile(filePath);
|
|
1380
|
+
const baseName = path.basename(rel).toLowerCase();
|
|
1381
|
+
if (baseName === "methods.js") {
|
|
1382
|
+
const text = buf.toString("utf8");
|
|
1383
|
+
if (!methodsJsSupportsChunkedUpload(text)) {
|
|
1384
|
+
const fallback = path.join(sdkPackageRoot(), "templates", "cms-starter", "public", "methods.js");
|
|
1385
|
+
try {
|
|
1386
|
+
buf = await fs.readFile(fallback);
|
|
1387
|
+
console.warn("[TomorrowOS] serving SDK methods.js with chunked uploads (project methods.js is outdated)");
|
|
1388
|
+
}
|
|
1389
|
+
catch {
|
|
1390
|
+
// keep project file
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1359
1394
|
const ext = path.extname(rel).toLowerCase();
|
|
1360
1395
|
const types = {
|
|
1361
1396
|
".html": "text/html; charset=utf-8",
|
|
@@ -1370,7 +1405,11 @@ export class TomorrowOS extends EventEmitter {
|
|
|
1370
1405
|
".gif": "image/gif"
|
|
1371
1406
|
};
|
|
1372
1407
|
const ctype = types[ext] ?? "application/octet-stream";
|
|
1373
|
-
|
|
1408
|
+
const headers = { "Content-Type": ctype };
|
|
1409
|
+
if (baseName === "methods.js") {
|
|
1410
|
+
headers["Cache-Control"] = "no-store";
|
|
1411
|
+
}
|
|
1412
|
+
res.writeHead(200, headers);
|
|
1374
1413
|
res.end(buf);
|
|
1375
1414
|
return true;
|
|
1376
1415
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tomorrowos/sdk",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.58",
|
|
4
4
|
"description": "TomorrowOS CMS server SDK - WebSocket transport, pairing, device commands, optional static CMS UI. Includes CLI (tomorrowos init / build) and starter templates.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "my-cms",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.58",
|
|
4
4
|
"description": "CMS server on @tomorrowos/sdk. Add your UI (React, static files, etc.) alongside this server.",
|
|
5
5
|
"private": true,
|
|
6
6
|
"type": "module",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"build-player": "tomorrowos build --platform tizen"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@tomorrowos/sdk": "^0.9.
|
|
16
|
+
"@tomorrowos/sdk": "^0.9.58",
|
|
17
17
|
"dotenv": "^17.2.3",
|
|
18
18
|
"tsx": "^4.19.0"
|
|
19
19
|
},
|
|
@@ -1928,27 +1928,8 @@ async function uploadFile(file, onProgress) {
|
|
|
1928
1928
|
}
|
|
1929
1929
|
}
|
|
1930
1930
|
|
|
1931
|
-
//
|
|
1932
|
-
|
|
1933
|
-
return uploadViaChunkedProxy(file, onProgress);
|
|
1934
|
-
}
|
|
1935
|
-
|
|
1936
|
-
let lastErr = null;
|
|
1937
|
-
for (let attempt = 1; attempt <= UPLOAD_MAX_RETRIES; attempt += 1) {
|
|
1938
|
-
try {
|
|
1939
|
-
const payload = await uploadFileWithProgress(file, { onProgress, attempt });
|
|
1940
|
-
return payload;
|
|
1941
|
-
} catch (err) {
|
|
1942
|
-
lastErr = err;
|
|
1943
|
-
const msg = err?.message || String(err);
|
|
1944
|
-
if (/Upload failed \(413\)/i.test(msg)) {
|
|
1945
|
-
return uploadViaChunkedProxy(file, onProgress);
|
|
1946
|
-
}
|
|
1947
|
-
if (attempt >= UPLOAD_MAX_RETRIES) break;
|
|
1948
|
-
await new Promise((resolve) => setTimeout(resolve, 500 * attempt));
|
|
1949
|
-
}
|
|
1950
|
-
}
|
|
1951
|
-
throw lastErr || new Error("Upload failed");
|
|
1931
|
+
// Always chunk through the CMS for Object Storage / local — avoids Replit 413.
|
|
1932
|
+
return uploadViaChunkedProxy(file, onProgress);
|
|
1952
1933
|
}
|
|
1953
1934
|
|
|
1954
1935
|
async function addAssetFromFile(file, queueIndex, queueTotal) {
|
|
@@ -1928,27 +1928,8 @@ async function uploadFile(file, onProgress) {
|
|
|
1928
1928
|
}
|
|
1929
1929
|
}
|
|
1930
1930
|
|
|
1931
|
-
//
|
|
1932
|
-
|
|
1933
|
-
return uploadViaChunkedProxy(file, onProgress);
|
|
1934
|
-
}
|
|
1935
|
-
|
|
1936
|
-
let lastErr = null;
|
|
1937
|
-
for (let attempt = 1; attempt <= UPLOAD_MAX_RETRIES; attempt += 1) {
|
|
1938
|
-
try {
|
|
1939
|
-
const payload = await uploadFileWithProgress(file, { onProgress, attempt });
|
|
1940
|
-
return payload;
|
|
1941
|
-
} catch (err) {
|
|
1942
|
-
lastErr = err;
|
|
1943
|
-
const msg = err?.message || String(err);
|
|
1944
|
-
if (/Upload failed \(413\)/i.test(msg)) {
|
|
1945
|
-
return uploadViaChunkedProxy(file, onProgress);
|
|
1946
|
-
}
|
|
1947
|
-
if (attempt >= UPLOAD_MAX_RETRIES) break;
|
|
1948
|
-
await new Promise((resolve) => setTimeout(resolve, 500 * attempt));
|
|
1949
|
-
}
|
|
1950
|
-
}
|
|
1951
|
-
throw lastErr || new Error("Upload failed");
|
|
1931
|
+
// Always chunk through the CMS for Object Storage / local — avoids Replit 413.
|
|
1932
|
+
return uploadViaChunkedProxy(file, onProgress);
|
|
1952
1933
|
}
|
|
1953
1934
|
|
|
1954
1935
|
async function addAssetFromFile(file, queueIndex, queueTotal) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "my-cms",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.58",
|
|
4
4
|
"description": "TomorrowOS CMS for Vercel / v0 Publish (Fluid Function + WebSockets + optional Next Preview).",
|
|
5
5
|
"private": true,
|
|
6
6
|
"type": "module",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"build-player": "tomorrowos build --platform tizen"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@tomorrowos/sdk": "^0.9.
|
|
20
|
+
"@tomorrowos/sdk": "^0.9.58",
|
|
21
21
|
"dotenv": "^17.2.3",
|
|
22
22
|
"tsx": "^4.19.0"
|
|
23
23
|
},
|