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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
docs: add docs/DEPS.md dependency audit reference
Adam Eivyd83ee03a29cb
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 7b13d03bba..9afdd40bd0 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -6,6 +6,8 @@## Added+- **`docs/DEPS.md` — dependency audit reference.** New living doc that records every third-party dependency in PortOS, its tier classification (1 acceptable / 2 audited / 3 removable), and per-package rationale for being kept. Generated by `/do:depfree` runs so future audits can cross-reference prior verdicts and re-audit triggers (e.g. "if `pm2`/`needle` drops `sax`, revisit"). First pass (2026-04-28, default mode): 30 deps audited, 0 removals — `kokoro-js` kept (only pure-JS in-process TTS, replacement requires Python subprocess + pooling), `sax` flagged REMOVE then downgraded to KEEP (transitive) because `pm2 → [email protected] → [email protected]` already pulls the same major version (direct removal saves zero supply chain attack surface). PLAN.md now points at `docs/DEPS.md` instead of duplicating the table.+- **One-click "Enable HTTPS" button on the Instances tab.** The Tailnet DNS & trusted HTTPS explainer used to instruct users to drop into a shell and run `npm run setup:cert`. New button on the same banner runs the same flow at runtime via a new `POST /api/instances/provision-cert` endpoint, which calls `tailscale cert` for the local MagicDNS hostname, writes `data/certs/{cert,key}.pem`, and updates `meta.json`. Failure modes (Tailscale not installed, not running, no MagicDNS hostname, HTTPS Certificates feature disabled in the tailnet admin) surface as toasts with actionable guidance. Because the HTTPS listener type is decided at server boot in `lib/tailscale-https.js`, the response includes `requiresRestart: true` whenever PortOS is currently running over HTTP — the UI then prompts the user to restart so the new cert actually takes effect; if HTTPS was already running, the existing `certRenewer` hot-swap path picks up the renewed cert without a restart. The button is disabled until MagicDNS is detected, mirroring what the underlying CLI requires. Files: `server/services/certProvisioner.js` (new), `server/routes/instances.js`, `client/src/services/apiSystem.js`, `client/src/pages/Instances.jsx`.- **Image Gen — third backend: Codex CLI `$imagegen`.** Image Gen can now route generation through the user's locally-installed Codex CLI built-in `image_gen` tool — invoked headlessly with `codex exec --skip-git-repo-check --sandbox workspace-write '$imagegen <prompt>'` so it uses the user's logged-in Codex session (no `OPENAI_API_KEY` required). New provider at `server/services/imageGen/codex.js` mirrors `local.js` (single-job model, SSE progress events) but harvests the resulting PNG from `~/.codex/generated_images/<session-id>/ig_*.png` after parsing the session id out of the codex launch banner — codex's stdout has no machine-readable image path, so banner-parse + dir-poll is the contract. Failure modes are surfaced clearly via `imageGenEvents`: empty session dir → "your Codex account may not allow image_gen", missing session id → "output format may have changed", non-zero exit → tail of stderr. Codex usage is gated by an explicit `Enable Codex Imagegen` setting because not every Codex plan exposes the `image_gen` tool — when disabled the option disappears from settings tile, image-gen page chip, voice tool dispatch, and palette gating up front.- **Image Gen — per-render backend chip.** New chip strip on the Image Gen page lets the user flip between Local / External / Codex per-render without changing the saved default. Only viable backends (External URL set, Local Python set, Codex enabled) appear; the strip hides itself when only one backend is configured. Selection is sent as `mode:` in `POST /api/image-gen/generate` and the dispatcher honors the override. Codex mode also hides backend-irrelevant knobs (steps, seed, guidance/CFG, LoRAs, quantize) since the built-in `image_gen` tool decides those internally. `GET /api/image-gen/status?mode=codex` lets the page probe a non-default backend before saving.diff --git a/PLAN.md b/PLAN.mdindex e86fabf735..f3506f017e 100644--- a/PLAN.md+++ b/PLAN.md@@ -20,6 +20,10 @@ For project goals, see [GOALS.md](./GOALS.md). For completed work, see [DONE.md]- [ ] **M50 P10 — Auto-Send with AI Review Gate** — Per-account/per-recipient trust level + dual-LLM review (drafter + reviewer). Only auto-send when both approve or trust ≥ 0.9. See [Messages Security](./docs/features/messages-security.md).- [ ] **M34 P5-P7 — Digital Twin** — Multi-modal capture (voice/video/image identity sources), advanced testing, personas. Ties to GOALS.md secondary "Multi-Modal Identity Capture".+### Depfree Audit — 2026-04-28++All dependencies audited and justified. 0 removals. See [docs/DEPS.md](./docs/DEPS.md) for the full classification table and per-package rationale.+### Better Audit — pending (2026-04-21)- [ ] **[HIGH][DRY]** `server/services/socket.js:595-814` — extract `broadcastToSet` + `registerSubscriber` to collapse 6× duplicated subscriber/broadcast boilerplate (also fixes missing `shellService.unsubscribeSessionList` on disconnect).diff --git a/docs/DEPS.md b/docs/DEPS.mdnew file mode 100644index 0000000000..35800fbdfd--- /dev/null+++ b/docs/DEPS.md@@ -0,0 +1,115 @@+# Dependency Audit (DEPS.md)++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)+**Verdict:** All dependencies justified. 0 removals.++## Audit Methodology++Each dependency is classified into one of three tiers:++- **Tier 1 (ACCEPTABLE)** — large, widely-audited, foundational libraries. Kept without question.+- **Tier 2 (SUSPECT)** — smaller libraries that may be replaceable. Audited for actual usage.+- **Tier 3 (REMOVABLE)** — clear candidates for owned-code replacement.++Before removing a Tier 3 candidate, run a transitive-dep check (`npm ls <pkg>`). If a kept package already pulls the same major version, the candidate is downgraded to **KEEP (transitive)** — direct removal saves no supply chain attack surface.++## Quick Reference Table++| Package | Tier | Verdict | Where Used | Notes |+|---------|------|---------|------------|-------|+| **Root devDeps** | | | | |+| `pm2` | 1 | KEEP | top-level scripts | Process manager, foundational |+| **Server deps** | | | | |+| `express` | 1 | KEEP | `server/index.js` + routes | Framework |+| `googleapis` | 1 | KEEP | Google integrations | Official Google SDK |+| `kokoro-js` | 2 | KEEP | `server/services/voice/tts-kokoro.js` | Only pure-JS in-process TTS; replacement = Python subprocess + pooling |+| `node-pty` | 1 | KEEP | shell/terminal services | Native PTY binding (N-API) |+| `pg` | 1 | KEEP | Postgres access | Official `pg` driver |+| `pm2` | 1 | KEEP | app lifecycle | Process manager |+| `portos-ai-toolkit` | 1 | KEEP | provider mgmt, prompts | Owned by author (separate repo) |+| `sax` | 3 → KEEP (transitive) | KEEP | `claudeChangelog.js`, `appleHealthXml.js` | Pulled by `pm2 → [email protected] → [email protected]` (deduped) — direct removal saves nothing |+| `socket.io` | 1 | KEEP | realtime | Foundational |+| `socket.io-client` | 1 | KEEP | server-to-client | Paired with socket.io |+| `ws` | 1 | KEEP | raw WebSocket | Widely-audited |+| `zod` | 1 | KEEP | input validation | Widely-audited |+| **Server devDeps** | | | | |+| `vitest` | 1 | KEEP | test runner | |+| `@vitest/coverage-v8` | 1 | KEEP | coverage | Paired with vitest |+| **Client deps** | | | | |+| `@dnd-kit/core` | 1 | KEEP | drag/drop | |+| `@dnd-kit/sortable` | 1 | KEEP | drag/drop | |+| `@dnd-kit/utilities` | 1 | KEEP | drag/drop helpers | |+| `@react-three/drei` | 1 | KEEP | CyberCity 3D | Three.js helpers |+| `@react-three/fiber` | 1 | KEEP | CyberCity 3D | React renderer for Three |+| `@xterm/xterm` | 1 | KEEP | browser terminal | |+| `@xterm/addon-fit` | 1 | KEEP | xterm sizing | |+| `@xterm/addon-web-links` | 1 | KEEP | xterm links | |+| `lucide-react` | 1 | KEEP | icons | Widely-used |+| `react` | 1 | KEEP | UI | |+| `react-dom` | 1 | KEEP | UI | |+| `react-router-dom` | 1 | KEEP | routing | |+| `recharts` | 1 | KEEP | charts | |+| `socket.io-client` | 1 | KEEP | realtime client | |+| `three` | 1 | KEEP | 3D | |+| **Client devDeps** | | | | |+| `@eslint/js` | 1 | KEEP | linting | |+| `eslint` | 1 | KEEP | linting | |+| `eslint-plugin-react` | 1 | KEEP | linting | |+| `eslint-plugin-react-hooks` | 1 | KEEP | linting | |+| `@tailwindcss/postcss` | 1 | KEEP | styling | |+| `tailwindcss` | 1 | KEEP | styling | |+| `@vitejs/plugin-react` | 1 | KEEP | build | |+| `vite` | 1 | KEEP | build | |++## Detailed Findings — Tier 2/3 Audits++### `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**: 1.2.1 published 2025-05-03. Active.+- **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.++### `sax` — KEEP (Transitive)++- **Direct usage**: 2 files — `server/services/claudeChangelog.js` (Atom feed parsing, ~5 events) and `server/services/appleHealthXml.js` (streaming Apple Health export, 3 event types on shallow `<record>` elements).+- **Initial verdict**: REMOVE. ~100 LOC of owned regex+state-machine parser would suffice for both use cases.+- **Transitive check**: `npm ls sax` →+ ```+ ├─┬ [email protected]+ │ └─┬ [email protected]+ │ └── [email protected] deduped+ └── [email protected]+ ```+- **Reversal reason**: same major version (1.4.4) deduped via pm2→needle. Removing the direct dep leaves the package in `node_modules` with identical attack surface. No consolidation target (no other XML parser kept).+- **Decision**: KEEP (transitive).+- **Re-audit trigger**: if `pm2`/`needle` drops sax (check on each pm2 major bump), revisit and replace with owned code.++## Heavy-Mode Notes++If `/do:depfree --heavy` is run, the following Tier 1 entries would drop to Tier 2/3 and become replacement candidates regardless of popularity:++- `googleapis` — narrow surface used; could be replaced with direct REST calls + owned auth.+- Many of the `@dnd-kit/*`, `@xterm/*`, `lucide-react`, `recharts` deps would be re-evaluated.+- `pm2` would NOT be replaced (foundational process manager) but its transitive `needle`/`sax` chain would still be considered "out of scope" since pm2 itself is kept.++This is intentionally NOT done in default mode — current dependency footprint is reasonable for the project's deployment context (single-user, Tailscale-private).++## Override Pins (`overrides`)++Defined in `package.json` (root + server + client) — kept current to dodge known upstream advisories:++- `[email protected]`+- `[email protected]`+- `[email protected]`+- `[email protected]`+- `[email protected]`+- `[email protected]`+- `minimatch@3 → [email protected]` (client only, scoped)++These exist purely to force-bump transitive deps; revisit if `npm audit` flags new advisories.