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

Merge pull request #5887 from atomantic/claim/issue-5688

[._.]/ Adam Eivyc81fc33711c7
diff --cc server/lib/README.md
index 7db0ce5424,6f2434be1a..825c66020b
--- a/server/lib/README.md
+++ b/server/lib/README.md
@@@ -408,8 -408,9 +408,10 @@@ pm` default, `NPM_CONFIG_PREFIX`, nvm/V
| `markdownText.js` | `stripMarkdownEmphasis(text)` — unwrap `**bold**` / `~~struck~~` / `` `code` `` / `[text](url)` and drop HTML comments, keeping the words. For strings handed to something that can't read markdown (a model's text encoder, a slug builder, TTS); leftover lone `*_~` become spaces so an unbalanced marker can't fuse two words. Does not collapse whitespace — callers that need that normalize themselves. |
| `renderSlot.js` | Render-slot helpers for `(proof\|final)Image` per stage. |
| `renderTargets.js` | Render-target alphabet (#3231): `RENDER_TARGET`/`RENDER_TARGETS` name every creative surface that enqueues renders (universe-bible, sprite-reference, music-video, …) — the keys into `settings.renderDefaults` — plus the `RENDER_TARGET_BACKEND_AUTO` fall-through sentinel. Dependency-free leaf; resolved per surface by `services/imageGen/cloudProviderConfig.js#resolveRenderTargetConfig`. |
+| `renderTiming.js` | `renderTimingFields(startedAtMs, nowMs?)` → the `{ renderMs, renderStartedAt, renderCompletedAt }` spread every image/video backend stamps on the record it persists, measuring ingestion → finished artifact (not queue wait). Returns `{}` when no start instant was observed, so absence stays the explicit unknown sentinel for the history cards and `services/videoGen/eta.js`. `omitRenderTiming(record)` is the inverse, for a DERIVED record built by spreading its source (an image variant) that must not inherit a duration it never took. |
| `telegramClient.js` | Telegram bot client. |
+ | `telegramMessage.js` | Pure builder for the Telegram notification wire message, shared by both transports (`services/telegram.js` and `services/telegramBridge.js`, which drifted apart while each kept a copy — #5688). `buildNotificationMessage(notification, { approvalBody })` → `{ text, options }`: emoji + escaped title, the body truncated to `TELEGRAM_MAX_RAW_CHARS` (2800) BEFORE escaping so the escaped result stays under Telegram's 4096 cap and a slice can't split an entity, the priority line, and the memory approve/reject `reply_markup` as a plain OBJECT (both transports post JSON, so a pre-serialized string would arrive as a literal string). `approvalBody` is resolved by the caller because the memory lookup is I/O. Also exports `escapeHtml`, `truncateForTelegram`, `isMemoryApprovalNotification`, the `NOTIFICATION_EMOJI`/`PRIORITY_EMOJI` maps (keyed by literal `NOTIFICATION_TYPES` values to stay a dependency-free leaf; pinned to the real enum by a parity test), and the `CALLBACK_APPROVE`/`CALLBACK_REJECT` prefixes the bot's `callback_query` handler parses back out. |
+ | `telegramRateLimit.js` | `createTokenBucket({ max = 30, refillMs = 60_000 })` → `{ consume() }` — the coarse full-refill-per-window bucket both Telegram transports use against Telegram's ~30 msg/min throttle. Each transport creates its OWN instance: they are never both active, and one shared bucket would let a transport inherit the other's drained budget. Pure (reads `Date.now()`, owns no timer). |
| `tempPathGuard.js` | Throwaway-path guard for destructive test fixtures. `isTempPath(target)` — true only for an absolute path that is a STRICT descendant of `os.tmpdir()` **after symlinks are resolved** (`os.tmpdir()` itself is refused, or `destroyGitSandbox(tmpdir())` would wipe every process's scratch; a `..` segment is refused rather than lexically collapsed; macOS `/var/folders/...` and `/private/var/folders/...` both pass). `assertTempPath(target, operation)` throws otherwise and returns `target` so it can wrap an argument inline. Use it before any fixture `git init` / `git config` / `rm -rf`: `spawn` silently substitutes `process.cwd()` for a missing cwd, which is how a test run once set `core.bare = true` on a real checkout (#4554). |
| `vaultCrypto.js` | Privacy Center PII Vault field-level encryption (issue #2140). AES-256-GCM `encryptValue`/`decryptValue` (`v1:<iv>:<tag>:<ct>` format, per-value 12-byte IV), `ensureVaultKey()` self-heal (generates `PRIVACY_VAULT_KEY` into the install root's `.env` on first write, replacing any invalid line; never logs the value), key resolution that falls back to reading `.env` so decrypt/status survive a server restart, `isVaultKeyConfigured()`, and the per-type `maskValue(type, plaintext)` display masking (last-4 / domain-visible / street-masked). Plaintext must never be logged by callers. |