Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

chore: align pm2 pins and refresh kokoro-js dependency audit (#2547)

[._.]/ Adam Eivyfffb595dc5c8
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 6bdbb8ad3f..3a6560b48f 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -13,6 +13,7 @@
## Documentation
+- **[issue-2547] Align the dual `pm2` pins and refresh the `kokoro-js` dependency audit.** The root `package.json` pinned `pm2` at `7.0.3` while `server/package.json` pinned `7.0.1`; both are now `7.0.3` (the higher pin, already reflected in the committed root lockfile — server lockfiles are gitignored, so no lockfile churn). `kokoro-js` (the only pure-JS in-process TTS path) is bumped from `1.2.0` to its latest patch `1.2.1` and flagged **maintenance watch** in `docs/DEPS.md` — no upstream publish since ~May 2025 — with an **already-implemented Piper escape hatch** documented for if it's dropped later (Piper is already a peer TTS backend — `tts-piper.js`'s `synthesizePiper` — sharing the same `(text, cfg, signal) → { wav, latencyMs }` contract, so dropping kokoro is a delete of the kokoro branch in `tts.js`, not a rewrite). `docs/DEPS.md`'s last-audited note is refreshed to 2026-07-14. Config/docs only — no runtime behavior change (API-compatible patch bump).
- **[issue-2546] Document missing `.env` vars and the boot `CREATE INDEX` lock window.** `.env.example` now carries commented entries with purpose notes for four vars the server actually reads but never documented: `PUBLIC_HOST` (public hostname baked into Google/Spotify OAuth redirect URIs), `SPOTIFY_REDIRECT_URI` (verbatim Spotify redirect override), `CODEX_HOME` (Codex CLI home scanned for provider-usage stats), and `HUGGINGFACE_TOKEN` (the fourth HF-token alias read by the Hugging Face catalog client). Separately, `ensureSchema()` in `server/lib/db.js` creates every index (incl. the HNSW vector index) non-`CONCURRENTLY`, so the first apply on a large pre-existing table takes a write-blocking lock at boot; a comment there and a new **Boot schema upgrades & the CREATE INDEX lock window** section in `docs/STORAGE.md` explain when this bites (existing-install upgrades, not fresh installs) and why the fix for a future large-table index is a `CONCURRENTLY` db-migration rather than changing `ensureSchema()`. Docs-only — no runtime behavior change.
## Fixed
diff --git a/docs/DEPS.md b/docs/DEPS.md
index adff6df556..06eab5e951 100644
--- a/docs/DEPS.md
+++ b/docs/DEPS.md
@@ -2,8 +2,8 @@
Living reference of every third-party dependency in PortOS, why it's kept, and what the current verdict is. Updated by `/do:depfree` runs.
-**Last audited:** 2026-04-28 (default mode); tables corrected 2026-07-01 during a docs audit.
-**Verdict:** All dependencies justified. Since the last full audit: `sax` was removed (replaced with an owned parser, issue #1824), `portos-ai-toolkit` was vendored in-tree (`server/lib/aiToolkit/`), and monolithic `googleapis` was replaced with scoped `@googleapis/*` packages.
+**Last audited:** 2026-07-14 (dependency-freedom follow-up, issue #2547); prior full audit 2026-04-28 (default mode), tables corrected 2026-07-01 during a docs audit.
+**Verdict:** All dependencies justified. Since the last full audit: `sax` was removed (replaced with an owned parser, issue #1824), `portos-ai-toolkit` was vendored in-tree (`server/lib/aiToolkit/`), and monolithic `googleapis` was replaced with scoped `@googleapis/*` packages. The 2026-07-14 follow-up bumped `kokoro-js` to its latest patch `1.2.1` (still on maintenance watch — no publish since 2025-05) and aligned the dual `pm2` pins (root + server both `7.0.3`).
## Audit Methodology
@@ -20,7 +20,7 @@ Before removing a Tier 3 candidate, run a transitive-dep check (`npm ls <pkg>`).
| Package | Tier | Verdict | Where Used | Notes |
|---------|------|---------|------------|-------|
| **Root devDeps** | | | | |
-| `pm2` | 1 | KEEP | top-level scripts | Process manager, foundational |
+| `pm2` | 1 | KEEP | top-level scripts | Process manager, foundational. Pinned `7.0.3` (aligned with server pin) |
| **Server deps** | | | | |
| `@googleapis/calendar` | 1 | KEEP | Calendar integration | Scoped official Google SDK (replaced monolithic `googleapis`) |
| `@googleapis/gmail` | 1 | KEEP | Messages/Gmail integration | Scoped official Google SDK |
@@ -30,7 +30,7 @@ Before removing a Tier 3 candidate, run a transitive-dep check (`npm ls <pkg>`).
| `node-pty` | 1 | KEEP | shell/terminal services | Native PTY binding (N-API) |
| `pdf-lib` | 1 | KEEP | PDF generation/manipulation | |
| `pg` | 1 | KEEP | Postgres access | Official `pg` driver |
-| `pm2` | 1 | KEEP | app lifecycle | Process manager |
+| `pm2` | 1 | KEEP | app lifecycle | Process manager. Pinned `7.0.3` (aligned with root pin) |
| `sharp` | 1 | KEEP | image processing | Native, widely-audited |
| `socket.io` | 1 | KEEP | realtime | Foundational |
| `socket.io-client` | 1 | KEEP | server-to-client | Paired with socket.io |
@@ -76,11 +76,12 @@ Before removing a Tier 3 candidate, run a transitive-dep check (`npm ls <pkg>`).
### `kokoro-js` — KEEP (Tier 2)
- **Usage**: 1 dynamic import in `server/services/voice/tts-kokoro.js` (~80 LOC module). 3 call sites: `KokoroTTS.from_pretrained()`, `tts.generate(text, {voice, speed})`, `audio.toWav()`.
-- **Maintenance**: pinned at 1.2.0. Active upstream.
+- **Maintenance**: pinned at `1.2.1` (latest; published 2025-05-03). **Maintenance watch** — no publish since ~May 2025, so the package is effectively stale even at latest. This is not disqualifying today (small, pure-JS, no CVEs), but re-evaluate on the trigger below.
- **Vulns**: None (npm audit clean).
- **Replacement complexity**: Moderate (~50–80 LOC) but requires Python subprocess + JSON IPC + process pooling + lifecycle management. Operational overhead exceeds the supply-chain risk.
-- **Decision**: KEEP. The only pure-JS in-process TTS option; Web Speech API is cloud-dependent and Piper requires CLI install.
-- **Re-audit trigger**: if maintenance lapses (no publish for >12 months) or a CVE is reported, revisit and migrate to Piper subprocess.
+- **Decision**: KEEP (on maintenance watch). The only pure-JS in-process TTS option; Web Speech API is cloud-dependent and Piper requires CLI install.
+- **Re-audit trigger**: the >12-months-stale trigger already fired and was actioned by this audit (bumped to latest, put on watch). Re-evaluate on any of: a CVE reported, the model-load path breaking against a newer Transformers.js, or the package still showing no upstream publish at the next dependency audit — then revisit and migrate (see escape hatch below).
+- **Piper escape hatch (if dropped later)**: Piper is **already implemented** as a peer backend — `server/services/voice/tts-piper.js` (`synthesizePiper(text, cfg, signal) → { wav, latencyMs }`, plus `listPiperVoices`), which `server/services/voice/tts.js` already dispatches to alongside `synthesizeKokoro`. Both backends share the same `(text, cfg, signal) → { wav, latencyMs }` contract, so dropping `kokoro-js` is a delete, not a rewrite: remove the `kokoro` branch (and the `tts-kokoro.js` module + its `kokoro-js` dependency) from the dispatcher in `tts.js` and let Piper be the default engine. The tradeoff Piper carries — and the reason it isn't the default today — is a native `piper` binary + ONNX voice download (vs. `kokoro-js`'s npm-only, in-process install).
### `sax` — REMOVED (issue #1824)
diff --git a/server/package.json b/server/package.json
index ab9925b600..2e7de9655d 100644
--- a/server/package.json
+++ b/server/package.json
@@ -19,11 +19,11 @@
"@googleapis/gmail": "^17.0.0",
"express": "5.2.1",
"google-auth-library": "^10.7.0",
- "kokoro-js": "1.2.0",
+ "kokoro-js": "1.2.1",
"node-pty": "1.2.0-beta.10",
"pdf-lib": "^1.17.1",
"pg": "8.22.0",
- "pm2": "7.0.1",
+ "pm2": "7.0.3",
"sharp": "0.35.2",
"socket.io": "4.8.3",
"socket.io-client": "4.8.3",