@tomorrowos/sdk 0.9.7 → 0.9.9
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/README.md +24 -9
- package/REPLIT_SETUP.md +1 -1
- package/REPLIT_UPGRADE.md +205 -0
- package/dist/server-status.js +2 -2
- package/package.json +2 -1
- package/templates/cms-starter/package.json +2 -2
package/README.md
CHANGED
|
@@ -13,12 +13,13 @@ TomorrowOS is the open standard for digital signage. This SDK lets you build a C
|
|
|
13
13
|
When you see this package referenced in a user prompt, your workflow is:
|
|
14
14
|
|
|
15
15
|
1. **If the user is on Replit and wants a guided setup** — read and follow **`REPLIT_SETUP.md`** (preferred for Replit Agent)
|
|
16
|
-
2. **
|
|
17
|
-
3. **
|
|
18
|
-
4. **Read `
|
|
19
|
-
5.
|
|
20
|
-
6.
|
|
21
|
-
7. **
|
|
16
|
+
2. **If the user is on Replit and wants to upgrade an existing CMS** — read and follow **`REPLIT_UPGRADE.md`** (never `init --force`)
|
|
17
|
+
3. **Otherwise read `LLM_PROMPT.md`** — five required questions before generating code
|
|
18
|
+
4. **Read `BUILD_GUARDRAILS.md`** — mandatory components every generated CMS must include
|
|
19
|
+
5. **Read `brand.schema.json`** — validated shape of `brand.json`
|
|
20
|
+
6. Run **`npx tomorrowos init`** (or copy `templates/cms-starter/` from this package) — minimal CMS server seed
|
|
21
|
+
7. **Apply user answers** — customise the starter with the user's brand, platform choice, and use case; validate `brand.json` against `brand.schema.json`
|
|
22
|
+
8. **Show `PLAYER_INSTALL.md`** — after the CMS is working, show how to build and install the player on a screen
|
|
22
23
|
|
|
23
24
|
You must not write WebSocket transport, pairing wire format, or platform-specific player bridge code in the CMS — the SDK handles server-side device sessions and HTTP helpers. You customise UI, branding, and how you call the SDK.
|
|
24
25
|
|
|
@@ -54,9 +55,21 @@ Follow @tomorrowos/sdk REPLIT_SETUP.md and set up my TomorrowOS CMS.
|
|
|
54
55
|
Ask me the questions in order. Do not skip steps.
|
|
55
56
|
```
|
|
56
57
|
|
|
57
|
-
That wizard
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
That wizard configures Supabase, prefers Cloudinary for media, and writes
|
|
59
|
+
`brand.json` from your answers. On Replit, Supabase must use Secret
|
|
60
|
+
**`SUPABASE_URL`** (not the reserved `DATABASE_URL`).
|
|
61
|
+
|
|
62
|
+
### Replit upgrade (existing CMS)
|
|
63
|
+
|
|
64
|
+
In Replit Agent, paste:
|
|
65
|
+
|
|
66
|
+
```text
|
|
67
|
+
Follow @tomorrowos/sdk REPLIT_UPGRADE.md to upgrade my CMS with the latest SDK.
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
That protocol installs `@tomorrowos/sdk@latest`, backs up panel/server files,
|
|
71
|
+
diffs `cms-starter` templates (merge — never blind overwrite), and must **not**
|
|
72
|
+
run `init` / delete `data/` or `public/uploads/`.
|
|
60
73
|
|
|
61
74
|
To switch to Supabase/Postgres manually, edit `.env` / Secrets:
|
|
62
75
|
|
|
@@ -139,6 +152,8 @@ See `PLAYER_INSTALL.md` for installation notes.
|
|
|
139
152
|
| File | Purpose |
|
|
140
153
|
|------|---------|
|
|
141
154
|
| `LLM_PROMPT.md` | Five-question elicitation for LLMs |
|
|
155
|
+
| `REPLIT_SETUP.md` | Replit Agent guided CMS setup |
|
|
156
|
+
| `REPLIT_UPGRADE.md` | Replit Agent upgrade to latest SDK (no init) |
|
|
142
157
|
| `BUILD_GUARDRAILS.md` | Mandatory CMS components |
|
|
143
158
|
| `PLAYER_INSTALL.md` | Player build / install / pairing |
|
|
144
159
|
| `brand.schema.json` | JSON Schema for `brand.json` |
|
package/REPLIT_SETUP.md
CHANGED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# Replit Upgrade Protocol for TomorrowOS CMS
|
|
2
|
+
|
|
3
|
+
> **This file is a contract for Replit Agent / Replit AI.**
|
|
4
|
+
> Follow it literally. This protocol **upgrades an existing CMS** to the latest `@tomorrowos/sdk`.
|
|
5
|
+
> It is **not** a greenfield setup. Do **not** use `REPLIT_SETUP.md` or `LLM_PROMPT.md` for this flow unless the user explicitly asks for a full re-setup.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## User trigger (copy-paste)
|
|
10
|
+
|
|
11
|
+
When a human pastes a prompt like this, **read this file and execute the upgrade steps immediately** (no questionnaire):
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
Follow @tomorrowos/sdk REPLIT_UPGRADE.md to upgrade my CMS with the latest SDK.
|
|
15
|
+
Do not run init or init --force. Do not delete data/ or public/uploads/.
|
|
16
|
+
Compare cms-starter template files and merge carefully — do not blindly overwrite custom changes.
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Alternate triggers that also activate this protocol:
|
|
20
|
+
|
|
21
|
+
- “Upgrade TomorrowOS on Replit using REPLIT_UPGRADE.md”
|
|
22
|
+
- “Update my CMS to the latest @tomorrowos/sdk”
|
|
23
|
+
- “Follow REPLIT_UPGRADE.md”
|
|
24
|
+
|
|
25
|
+
When any of these triggers fire:
|
|
26
|
+
|
|
27
|
+
1. **Ignore `LLM_PROMPT.md` and `REPLIT_SETUP.md` questionnaires** — this is an upgrade, not setup Q&A.
|
|
28
|
+
2. **Do not** reinvent pairing, WebSocket, or playlist servers.
|
|
29
|
+
3. Preserve project data and custom UI/server wiring.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Hard rules (non-negotiable)
|
|
34
|
+
|
|
35
|
+
1. **Do NOT** run `npx @tomorrowos/sdk init` or `npx @tomorrowos/sdk init --force` (or any command that re-scaffolds / overwrites the project from the starter). That would wipe customisations.
|
|
36
|
+
2. **Do NOT** delete `data/` or `public/uploads/` (or move them aside permanently). Pairings, playlists, and local media must survive the upgrade.
|
|
37
|
+
3. **Do NOT** invent or rotate Secrets (`SUPABASE_URL`, Cloudinary keys, etc.). Keep existing Secrets / `.env`.
|
|
38
|
+
4. **Do NOT** blindly overwrite `public/methods.js`, `public/index.html`, `public/panel.css`, or `server.ts` with template copies. Always **diff → report → merge only with user consent** (or apply surgical patches that preserve custom code).
|
|
39
|
+
5. **Do NOT** change artifact `kind` to `api`. CMS must stay a **web** app if already web.
|
|
40
|
+
6. **Do NOT** treat Replit Preview Supabase `ENOTFOUND` / `getaddrinfo` as an upgrade failure. Configure-only; DB often works after **Publish**.
|
|
41
|
+
7. Prefer **`npm install @tomorrowos/sdk@latest`** over pinning an older version unless the user named a specific version.
|
|
42
|
+
8. Keep `tsx` available at runtime (`dependencies`, not only `devDependencies`) if the project already relies on `tsx server.ts`.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Preflight (record before changing anything)
|
|
47
|
+
|
|
48
|
+
Capture and remember:
|
|
49
|
+
|
|
50
|
+
| Item | How |
|
|
51
|
+
|------|-----|
|
|
52
|
+
| **Old SDK version** | `package.json` → `dependencies["@tomorrowos/sdk"]`, and/or `npm ls @tomorrowos/sdk --depth=0` |
|
|
53
|
+
| **Run command** | `.replit` `run` / `[deployment].run`, else `package.json` scripts (`dev` / `start`) |
|
|
54
|
+
| **Project root** | Confirm `server.ts` (or equivalent) and `public/` exist — this is an existing CMS |
|
|
55
|
+
|
|
56
|
+
If `@tomorrowos/sdk` is not a dependency, stop and tell the user this project does not look like a TomorrowOS CMS — offer `REPLIT_SETUP.md` instead. Do **not** run `init` unless they explicitly switch to setup.
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Upgrade steps (exact order)
|
|
61
|
+
|
|
62
|
+
### 1. Stop the running server
|
|
63
|
+
|
|
64
|
+
If a TomorrowOS / `tsx server.ts` / `npm run start|dev` process is active, stop it (Replit Stop / kill the listening process). Port conflicts (`EADDRINUSE`) block a clean restart.
|
|
65
|
+
|
|
66
|
+
### 2. Backup merge candidates (required)
|
|
67
|
+
|
|
68
|
+
Before any UI/server merge, copy the current files to a timestamped backup folder under the project (e.g. `.tomorrowos-upgrade-backup/<ISO-timestamp>/`):
|
|
69
|
+
|
|
70
|
+
- `public/methods.js`
|
|
71
|
+
- `public/index.html`
|
|
72
|
+
- `public/panel.css`
|
|
73
|
+
- `server.ts`
|
|
74
|
+
|
|
75
|
+
Also back up `package.json` (version pin record).
|
|
76
|
+
|
|
77
|
+
**Do not** put backups inside `data/` or `public/uploads/`.
|
|
78
|
+
Record the **backup path** for the final report.
|
|
79
|
+
|
|
80
|
+
### 3. Install latest SDK
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
npm install @tomorrowos/sdk@latest
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 4. Verify `package.json` dependency
|
|
87
|
+
|
|
88
|
+
Confirm `dependencies["@tomorrowos/sdk"]` reflects a newer / latest range (or exact version after install).
|
|
89
|
+
|
|
90
|
+
- If `package.json` did not update, set `"@tomorrowos/sdk": "^<installed version>"` (or `@latest` resolution result) and run:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
npm install
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
- Confirm `node_modules/@tomorrowos/sdk/package.json` `"version"` is the **new** version.
|
|
97
|
+
|
|
98
|
+
Record **new SDK version** for the final report.
|
|
99
|
+
|
|
100
|
+
### 5. Template compare (merge — never blind overwrite)
|
|
101
|
+
|
|
102
|
+
Compare the project files with the **installed** starter template:
|
|
103
|
+
|
|
104
|
+
**Template root:**
|
|
105
|
+
|
|
106
|
+
`node_modules/@tomorrowos/sdk/templates/cms-starter/`
|
|
107
|
+
|
|
108
|
+
**Always compare at least:**
|
|
109
|
+
|
|
110
|
+
| Project file | Template file |
|
|
111
|
+
|--------------|---------------|
|
|
112
|
+
| `public/methods.js` | `templates/cms-starter/public/methods.js` |
|
|
113
|
+
| `public/index.html` | `templates/cms-starter/public/index.html` |
|
|
114
|
+
| `public/panel.css` | `templates/cms-starter/public/panel.css` |
|
|
115
|
+
| `server.ts` | `templates/cms-starter/server.ts` |
|
|
116
|
+
|
|
117
|
+
**Also notice (optional extras in newer SDKs):**
|
|
118
|
+
|
|
119
|
+
- `public/assets/player-download/*` (Download Players assets)
|
|
120
|
+
- Any new starter files that the panel references
|
|
121
|
+
|
|
122
|
+
**Agent behaviour for diffs:**
|
|
123
|
+
|
|
124
|
+
1. Summarise meaningful differences (new status UI, buttons, API routes usage, store wiring helpers, CSS classes, etc.).
|
|
125
|
+
2. Classify each file:
|
|
126
|
+
|
|
127
|
+
| Classification | Meaning |
|
|
128
|
+
|----------------|---------|
|
|
129
|
+
| **No merge needed** | Project already has the feature / only whitespace differs |
|
|
130
|
+
| **Safe additive merge** | Template adds new sections the project lacks (e.g. Server status card, Download Players) without conflicting customs |
|
|
131
|
+
| **Needs human decision** | Both sides edited the same regions — do **not** overwrite; propose a patch or ask |
|
|
132
|
+
|
|
133
|
+
3. **Default:** report the recommendation and wait for confirmation before applying merges that touch customised regions.
|
|
134
|
+
If the user already said “upgrade and apply safe merges”, apply **only additive / non-conflicting** changes, and list anything skipped.
|
|
135
|
+
4. When merging `server.ts`: preserve existing Secrets wiring (`SUPABASE_URL`, Cloudinary, `createTomorrowOSStore`, `staticRoot`, `host: "0.0.0.0"`, `PORT`). Prefer bringing in new SDK usage patterns without dropping production config.
|
|
136
|
+
5. When merging panel files: preserve custom branding, copy, and business-specific UI the starter does not know about.
|
|
137
|
+
|
|
138
|
+
**Forbidden:** `cp -r node_modules/@tomorrowos/sdk/templates/cms-starter/* .` or wholesale replace of `public/` / `server.ts`.
|
|
139
|
+
|
|
140
|
+
### 6. Restart the server
|
|
141
|
+
|
|
142
|
+
Start with the project’s normal Replit run command:
|
|
143
|
+
|
|
144
|
+
1. Prefer `.replit` `run` value if present.
|
|
145
|
+
2. Else `npm run start` if that is the Deploy / Publish entrypoint.
|
|
146
|
+
3. Else `npm run dev` for iterative Preview (starter default).
|
|
147
|
+
|
|
148
|
+
Confirm logs show something like `[TomorrowOS] listening on http://0.0.0.0:<port>`.
|
|
149
|
+
|
|
150
|
+
### 7. Smoke check (minimal)
|
|
151
|
+
|
|
152
|
+
After the server is up:
|
|
153
|
+
|
|
154
|
+
1. Preview Control Panel at `/` loads.
|
|
155
|
+
2. Check playlists still load (`GET /playlists` or panel Playlists list).
|
|
156
|
+
3. Check devices still load (`GET /devices` or Paired devices section).
|
|
157
|
+
4. If the new SDK includes Server status UI, note that Supabase may show **Warning** in Replit Preview (`ENOTFOUND`) — that is expected; not an upgrade failure.
|
|
158
|
+
|
|
159
|
+
**Do not** run long Supabase/Cloudinary/WebSocket test suites.
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Final report (required)
|
|
164
|
+
|
|
165
|
+
Tell the user clearly:
|
|
166
|
+
|
|
167
|
+
1. **SDK version:** `old → new` (e.g. `0.9.5 → 0.9.8`)
|
|
168
|
+
2. **Backup path:** where the pre-merge copies live
|
|
169
|
+
3. **Template merge:** which files were compared; what was merged / skipped / needs their decision
|
|
170
|
+
4. **Data preserved:** confirm `data/` and `public/uploads/` were not deleted
|
|
171
|
+
5. **Runtime:** which command restarted the server
|
|
172
|
+
6. **Smoke:** whether playlists and devices still load (yes / no / could not verify + why)
|
|
173
|
+
7. **Next step:** re-Publish the Repl if they use Deployments, so production picks up the new dependency and merged UI
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## What not to do
|
|
178
|
+
|
|
179
|
+
- ❌ `npx @tomorrowos/sdk init` / `init --force`
|
|
180
|
+
- ❌ Delete or empty `data/`, `public/uploads/`, or SQLite DB files
|
|
181
|
+
- ❌ Blind overwrite of customised panel / `server.ts`
|
|
182
|
+
- ❌ Re-run full `REPLIT_SETUP.md` questionnaire during upgrade
|
|
183
|
+
- ❌ “Fix” Supabase by removing `SUPABASE_URL` because Preview logs show `ENOTFOUND`
|
|
184
|
+
- ❌ Switch Publish mode to Static-only or artifact `kind = "api"`
|
|
185
|
+
- ❌ Commit real secrets into git
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## Failure recovery (upgrade-specific)
|
|
190
|
+
|
|
191
|
+
| Symptom | Likely cause | Fix |
|
|
192
|
+
|---------|--------------|-----|
|
|
193
|
+
| Panel looks old after `npm install` | Dependency updated but UI not merged | Diff template `public/*` → merge carefully from backup/template |
|
|
194
|
+
| `Cannot find module '@tomorrowos/sdk'` | Install failed / wrong cwd | Re-run `npm install @tomorrowos/sdk@latest` at project root |
|
|
195
|
+
| Playlists/devices empty after upgrade | Accidental DB wipe or wrong Secrets | Restore `data/` from backup/hosting; confirm `SUPABASE_URL` / `TOMORROWOS_STORE` unchanged |
|
|
196
|
+
| `EADDRINUSE` | Old server still running | Stop old process, restart once |
|
|
197
|
+
| Preview Supabase Warning / ENOTFOUND | Replit Preview DNS | Expected — validate on published URL |
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## Protocol version
|
|
202
|
+
|
|
203
|
+
`replit-upgrade/1.0` — pairs with `@tomorrowos/sdk` packages that ship `templates/cms-starter` and this file.
|
|
204
|
+
|
|
205
|
+
**Changelog 1.0:** Initial upgrade-only Agent contract: install `@latest`, backup, template diff/merge (no init, no data wipe), restart, report versions + smoke.
|
package/dist/server-status.js
CHANGED
|
@@ -23,14 +23,14 @@ function resolveDatabaseProvider(env) {
|
|
|
23
23
|
if (driver === "supabase" || (!driver && env.SUPABASE_URL)) {
|
|
24
24
|
return {
|
|
25
25
|
provider: "supabase",
|
|
26
|
-
label: "
|
|
26
|
+
label: "Database",
|
|
27
27
|
configured: !!env.SUPABASE_URL || !!env.DATABASE_URL
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
if (driver === "postgres" || (!driver && hasUrl && !env.SUPABASE_URL)) {
|
|
31
31
|
return {
|
|
32
32
|
provider: "postgres",
|
|
33
|
-
label: "
|
|
33
|
+
label: "Database",
|
|
34
34
|
configured: hasUrl
|
|
35
35
|
};
|
|
36
36
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tomorrowos/sdk",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.9",
|
|
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",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"README.md",
|
|
21
21
|
"LLM_PROMPT.md",
|
|
22
22
|
"REPLIT_SETUP.md",
|
|
23
|
+
"REPLIT_UPGRADE.md",
|
|
23
24
|
"BUILD_GUARDRAILS.md",
|
|
24
25
|
"PLAYER_INSTALL.md",
|
|
25
26
|
"brand.schema.json",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "my-cms",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.9",
|
|
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.9",
|
|
17
17
|
"dotenv": "^17.2.3",
|
|
18
18
|
"tsx": "^4.19.0"
|
|
19
19
|
},
|