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

21.4 KB
Raw Blame

Release v2.7.0

Released: 2026-05-23

Full Changelog

Full Diff: https://github.com/atomantic/PortOS/compare/v2.6.0...v2.7.0

Added

  • Peer-sync coverage for media collections, closing the gap where per-universe and per-series image/video buckets (the data/media-collections.json records that drive the "Universe: X" galleries with 74 / 124 / etc items) never propagated to peers. The file sat outside every sync category, and the per-record push pipeline couldn't help either: collection item adds emit recordEvents.updated('universe', id), but the universe record itself doesn't move, so the lastPushedHash short-circuit treated every push as unchanged and the receiver's collection diverged permanently. Fix is in three layers — (1) new mediaCollections snapshot category in server/services/dataSync.js with a mergeMediaCollectionsFromSync entrypoint that LWWs scalars and unions items by kind:ref so neither side ever loses a render to a collection-level updatedAt race; the per-collection write goes through the same serializeFileWrite tail every other mediaCollections mutator uses. (2) The universe / series push payload in server/services/sharing/peerSync.js now bundles the linked collection (findCollectionByUniverseId / findCollectionBySeriesId) and the asset manifest includes each item's ref so image bytes flow through the existing receiver-side asset-pull worker — simplePayloadHash covers linkedCollection so the short-circuit can no longer collapse a collection-only edit. Tombstone pushes deliberately skip the collection bundle so a deleted universe doesn't re-create an empty bucket on the peer. (3) applyIncomingPush routes the bundled linkedCollection through mergeMediaCollectionsFromSync so the receiver's JSON converges atomically with the record merge. DEFAULT_SYNC_CATEGORIES in services/instances.js, the route enum in routes/dataSync.js, AND the syncCategoriesSchema Zod in routes/instances.js all gain mediaCollections (Zod's default object parsing strips unknown keys, so PATCH syncCategories.mediaCollections would otherwise silently no-op — same regression class the universe + pipeline schema fix patched earlier). The client's SYNC_CATEGORY_META adds the row.

  • ephemeral: true field on universes, series, and issues — a local-only "don't sync to peers" marker. Set on POST (create) or PATCH; sanitizer normalizes anything non-true back to absent. The wire / push / subscribe / merge / asset layers ALL honor the flag end-to-end:

    • Wire (sanitizeRecordForWire): returns null for live ephemeral records so both transports (60s snapshot loop + per-record push) skip them. Tombstones for ephemeral records still cross the wire — a once-shared record marked ephemeral then deleted still propagates its delete so peers that still hold the live copy converge. The ephemeral field itself is stripped from every wire output so the byte-stable checksum invariant survives even when a stray ephemeral: false lives on disk.
    • Subscription lifecycle: createUniverse / createSeries skip auto-subscribe for ephemeral records. updateUniverse / updateSeries PATCH transitions are wired: false→true tears down every per-record sub for the record (new unsubscribeAllForRecord helper); true→false re-fires autoSubscribeRecordToAllPeers so the now-shareable record reaches every peer with the matching category. autoSubscribePeerToAllRecords (peer:online backfill) filters ephemeral records out of the set-diff.
    • Receiver-side merges (mergeUniversesFromSync / mergeSeriesFromSync / mergeIssuesFromSync): strip inbound ephemeral field unconditionally (a buggy/older/non-conformant peer can't plant a "dark" record on the receiver), and refuse the merge entirely when the LOCAL record is ephemeral — peer edits can't overwrite content, peer deletes can't trigger our orphan cascade, and the post-merge asset-pull worker never schedules downloads for local-ephemeral records.
    • Series asset manifest: ephemeral AND deleted child issues are filtered out of the asset-manifest input to buildAssetManifestForSeries (not just out of the bundled issues array). Their tombstones still ride in the bundled issues so the receiver's delete cascade can finish — only their asset filenames are stripped, so the receiver doesn't pull bytes for records it's about to orphan. Same rule applies at the top level: a tombstone push for a deleted universe or series ships an empty assetManifest (the deleted record itself still crosses so the peer can converge).
    • peerSync listener now also subscribes to recordEvents.deleted (not just 'updated') so soft-deletes propagate via the per-record push pipeline — previously they were stranded for any peer that had a per-record sub (which is most peers under the new auto-subscribe). retryPendingPushesForPeer walks every sub (not just unpushed ones) on peer:online; the lastPushedHash short-circuit inside pushRecordToPeer skips the network call for unchanged records, so out-of-band file edits (cleanup scripts, hand-edits) re-propagate on the next reconnect.

    New scripts/cleanup-test-data.js one-shot soft-deletes records matching a conservative test-fixture name roster (Test Work, Commit U, Commit S, etc. — generic names like 'A'/'B'/'Live'/'Hidden' deliberately excluded to avoid clobbering real user records), cascading the delete to child issues of each tombstoned series so the orphan-zombie state never materializes. Default is dry-run; --apply writes; users restart PM2 afterward to trigger propagation.

  • quick-image dashboard widget — a textarea + Generate button that hands the typed prompt off to the Image Gen page via ?prompt=… (the same query-param the Media History remix flow already consumes). Registered in widgetRegistry.jsx and seeded into the default Everything layout in server/services/dashboardLayouts.js. Existing installs pick it up via migration 033-seed-quick-image-widget.js, which inserts the widget at its preferred grid slot below quick-brain when free and appends below the existing grid otherwise; only the built-in default layout is touched. Cmd+Enter in the textarea submits.

  • Federated peer-sync tombstone GC (Stage 5 of 5). New server/services/sharing/tombstoneGc.js runs once per 60s sync tick and prunes tombstoned universes / series / issues that every subscribed peer has acked + a 24h grace buffer. The cutoff is min(now, minAckedAcrossPeers) - 24h, which collapses the "no peers subscribed" and "peers behind" cases into one formula (Infinity from an empty peer list clamps via Math.min to now). Issue tombstones use the series ack horizon since issues ride series pushes. Three new exports (pruneTombstonedUniverses, pruneTombstonedSeries, pruneTombstonedIssues) on the record services are mechanical-prune helpers — the GC module owns the policy. syncOrchestrator dynamically imports sweepTombstones to keep the GC's universe / pipeline / sharing graph off the orchestrator's boot path. Logs only when prune count > 0.

  • Federated peer-sync UI + receiver-side asset pull (Stage 4 of 5). New SyncToPeerButton (client/src/components/sharing/SyncToPeerButton.jsx) appears next to the existing ShareToButton on Universe and Series pages — a dropdown of every enabled peer with a check/circle toggle to subscribe/unsubscribe. New MediaImage component (client/src/components/MediaImage.jsx) wraps <img> and renders a "Syncing" placeholder when the asset 404s (peer-pushed records reference UUIDs that haven't been pulled yet); a peerSync:asset-arrived socket event swaps the placeholder for the live bytes the moment the receiver's worker lands them. The Instances page now shows a per-peer "Live-pushed records" section listing every active sync subscription with a one-click unsubscribe and a ↩ reverse badge for subs that were auto-created by an inbound push. New receiver-side pullMissingAssetsFromPeer worker in server/services/sharing/peerSync.js background-fetches each missing asset from the sender's /data/{kind-dir}/<filename> static mount and writes it locally (capped at 100MB per asset, filenames re-validated against path traversal even after the diff already sanitized them). peerSyncEvents is wired through sharing/index.js to socket clients so the UI updates in real time.

  • Federated peer-sync HTTP routes and orchestrator wiring (Stage 3 of 5). New server/routes/peerSync.js mounts at /api/peer-sync with POST /push (receiver-side; wraps applyIncomingPush with Zod-validated payload + asset-manifest size cap of 2000), GET/POST /subscriptions (list + create local outgoing subs), and DELETE /subscriptions/:id. installPeerSyncListener() now runs alongside installSubscriptionListener in initSharing so one recordEvents 'updated' fan-out drives both the share-bucket and peer-sync transports. syncOrchestrator now consults listPeerSubscriptions(peerId) per cycle and skips the snapshot category for any (peer, kind) pair where a per-record peer subscription exists (universe-sub → skip 'universe' snapshot; series-sub → skip 'pipeline' snapshot) so the push pipeline owns the wire for subscribed pairs and the 60s loop stops re-applying the same records. Asset static mounts under /data/{images,image-refs,videos,video-thumbnails} now pass acceptRanges: true explicitly so the receiver's background asset-pull can resume partial downloads over flaky Tailnet links (default of serve-static, now encoded as a contract so it can't accidentally regress).

  • Federated peer-sync pipeline modules (Stage 2 of 5). New server/services/sharing/peerSync.js holds the per-record subscription store (data/sharing/peer_subscriptions.json), the asset-manifest builder, the push pipeline that serializes a record + its child issues + the SHA-manifest to a peer's /api/peer-sync/push endpoint, and the receiver-side applyIncomingPush that merges via the existing merge*FromSync LWW path, computes the asset-diff response, and best-effort auto-creates a reverse subscription back to the sender (honoring per-peer directions: ['inbound'] to skip when explicitly inbound-only). New server/services/sharing/peerTombstoneCursors.js holds per-peer lastAckedDeleteAt water-marks so a tombstone is only GC'd once every subscribed peer has acked it (with a subscribedSince horizon so late-joining peers don't have to ingest every historical deletion). State writes serialize through a module-level writeTail so a fire-and-forget push can't clobber a concurrent subscribe write on the same JSON. The actual HTTP routes and orchestrator wiring land in Stage 3.

  • Foundation for federated peer sync of Universes, Series, and Issues (Stage 1 of 5). Soft-delete (deleted + deletedAt tombstone fields) is now part of the on-disk record for universes, series, and issues — so a delete propagates to other PortOS instances via the existing LWW snapshot merge instead of vanishing locally and resurrecting from a peer. listUniverses / listSeries / listIssues (and their per-id getters) filter tombstones by default; pass { includeDeleted: true } to see them. mergeUniversesFromSync / mergeSeriesFromSync / mergeIssuesFromSync detect delete-transitions and fire the same orphan-cleanup cascades as a local delete (media-collection unlink, slot-map clear, issue renumber). New server/lib/syncWire.js is the single source of truth for what fields cross the peer wire (today it strips runs[] from universe state — shared by the 60s snapshot loop and the upcoming per-record push). New server/lib/assetHash.js persists SHA-256 hashes in each data/images/{uuid}.metadata.json sidecar so both the share-bucket exporter and the upcoming peer-sync push pipeline reuse the same value (no per-bucket recomputation, no per-transport cache). insertUniverseWithId / insertSeriesWithId / insertIssueWithId now overwrite a tombstoned record (re-import undeletes) but still reject DUPLICATE on a live record.

Changed

  • Default Claude CLI and TUI providers now ship with the undated model trio (claude-haiku-4-5, claude-sonnet-4-6, claude-opus-4-7) and pin claude-opus-4-7 as the default model. data.sample/providers.json, the aiToolkit defaults (server/lib/aiToolkit/defaults/providers.sample.json), and the scaffolded-project providers in server/routes/scaffoldPortOS.js all match. Existing installs get the same shift via migration 032-claude-default-opus-4-7.js, which only rewrites a Claude provider when its models array still matches the previously-seeded dated list (*-20251001/*-20250929/*-20251101/claude-opus-4-6) — so a user who curated their own model list is left alone.
  • reference-watch task now appends slug-tagged [ref-watch-…] checklist items directly to PLAN.md instead of writing a standalone REFERENCE_REVIEW.md proposal file. Adopt-worthy commits become actionable PLAN items that /claim / plan-task can pick up; Maybe items get the same shape with a **Decision needed:** clause; security-flagged commits get no PLAN entry and are mentioned only in the final assistant summary. Prompt version bumped to v2; non-customized v1 prompts auto-upgrade on next schedule load.

Removed

  • Top-level /reference-repos global summary page and sidebar entry. Reference repos are now exclusively app-scoped — manage them via each app's "References" tab. Removed client/src/pages/ReferenceRepos.jsx, the route + lazy import from client/src/App.jsx, the sidebar entry from client/src/components/Layout.jsx, and the nav.reference-repos entry from server/lib/navManifest.js (the manifest's shape-invariant tests cover the deletion automatically). The compact / initialRefs props on ReferenceReposPanel are gone since the global summary was their only consumer.

Fixed

  • Instances page no longer claims Universe: behind / Pipeline: behind for peers that are actually converged via the per-record push pipeline. When per-record subscriptions cover a category, the 60s snapshot loop intentionally skips it, so the cursor.checksums[cat] water-mark freezes at whatever it was when the first sub was created. The UI's cursorChecksum !== remoteChecksum test then flagged "behind" forever even though the push pipeline was keeping records in sync. SnapshotSyncBadge now takes a livePushCovered prop derived from the peer's actual subscriptions (universe-subs cover 'universe', series-subs cover 'pipeline' — mirrors the inverse map in peerSync.js's KIND_TO_CATEGORY) and renders a distinct live-push state instead. The subscription fetch is lifted from PeerSyncSubscriptionsSection to PeerCard so both children share one network call.
  • macOS "Enable HTTPS" on the Instances page failed with tailscale cert failed: ... operation not permitted when the only Tailscale CLI on the machine was the Mac App Store / GUI app bundle. The MAS build runs under macOS App Sandbox and can't write the LE cert temp file outside its container. PortOS now: (1) reorders TAILSCALE_CANDIDATES in server/lib/tailscale.js so Homebrew (/opt/homebrew/bin/tailscale, /usr/local/bin/tailscale) is preferred over the App-bundle (kept as last-resort fallback); (2) detects the sandboxed-only state at boot via the new hasOnlySandboxedTailscale() helper and prints actionable brew install tailscale guidance from scripts/setup-cert.js before the doomed tailscale cert call; (3) rewrites the runtime EPERM toast in server/services/certProvisioner.js to point at the brew fix instead of surfacing raw sandbox stderr (new tailscale-sandboxed reason code); (4) on macOS, ./setup.sh now detects the sandboxed-only state via the JS helper (single source of truth for the candidate paths) and unattended-installs brew install tailscale when available, with printed guidance when brew is missing. Non-fatal in every branch.
  • Federated peer-sync category toggles for Universe and Pipeline silently no-op'd. The Zod syncCategoriesSchema in server/routes/instances.js was missing both keys; Zod's default object parsing strips unknown keys, so the PATCH validated as an empty syncCategories object, the service-side merge became a no-op, and the checkbox stayed unchecked with no server-side error. Added universe and pipeline to the schema to restore parity with DEFAULT_SYNC_CATEGORIES and the UI's SYNC_CATEGORY_META.
  • Auto-run the world → universe data rename on server boot. The conversion previously shipped as a manual CLI script (server/scripts/migrateWorldToUniverse.js) that nobody knew to invoke, so installs upgrading from the World Builder era kept stale data/world-builder.json files and never saw their worlds appear as universes. The new migration 031-world-to-universe-data-rename.js does the file rename, top-level key rename (worlds→universes), worldId→universeId rewrite in pipeline-series.json, worldRun→universeRun rewrite in media-jobs.json, and also relinks any "World: <name>" render collections in media-collections.json to their universe by canonical-name match.
  • Universe Builder picker dropdown rendered beneath the tab subnav and downstream section cards in Lumen Glass / Blueprint Ops themes. Those themes ship a non-none --port-backdrop-filter, and the global rule in index.css applies it to every .bg-port-card.border.rounded* — which turns each such card into its own stacking context. The picker's absolute z-30 dropdown was trapped inside the header card's context and couldn't paint over later sibling cards. Adding relative z-30 to the picker's <header> lets that stacking context win against subsequent siblings so the dropdown overlays them as intended.
  • TUI agent raw-PTY buffer no longer truncates the head at ~640KB ("⚠️ raw PTY buffer exceeded 1MB — head dropped"). The buffer feeds analyzeAgentFailure at finalize, so silently slicing the head was the exact behavior the warning admitted to ("failure analysis may miss earlier symptoms"). server/services/agentTuiSpawning.js now spools raw PTY bytes to a per-agent raw.txt file in 250ms-debounced batches (mirroring the existing parsed-output pipeline that writes output.txt), so the in-memory footprint stays bounded regardless of run length. analyzeAgentFailure reads the tail of the file (last 1MB) on failure via a non-throwing readFileTail helper; successful runs skip the read entirely. The paste-marker poll keeps only a short-lived post-paste accumulator that lives for the paste window. A 256MB disk safety valve truncates raw.txt if a runaway agent exceeds the cap (preserves the most-recent bytes that readFileTail actually consumes; warns once and sets a rawSpoolTruncated agent-metadata flag). The old rawBufferTruncated flag is gone with the in-memory truncation logic.
  • MortalLoom iCloud reads now survive macOS Optimize-Mac-Storage evictions. The prior fix tolerated EAGAIN/-11 from bird's coordination locks by warning + returning null, but every dashboard Proactive Alerts poll (every 2 min via useAutoRefetch) still surfaced the warning whenever the file had been evicted: existsSync returns true on a placeholder, then readFile triggers an async download that doesn't return inline, so the read fails with EAGAIN. server/services/mortalLoomStore.js now (1) retries every transient readFile/writeFile/stat up to three times with 50ms then 100ms backoff before falling through to the warn path — covers the common <200ms coordination/materialize windows so transients are invisible to the UI; (2) fires brctl download <path> against the configured store path at server boot (and again whenever settings:updated flips MortalLoom sync on or changes the path) so macOS pre-materializes the file. Note that brctl download only triggers the download — it does not set a persistent "Keep Downloaded" flag (that requires Finder, or undocumented brctl unevict), so re-eviction under future disk pressure is still possible; the retry path is what guarantees the hardening, the pre-materialize just collapses the first-read latency. Best-effort and macOS-only — non-darwin and missing-brctl environments fall through to the retry path. Disabling sync clears the dedup cache so a later re-enable with the same path re-materializes instead of silently no-op'ing.
  • GET /api/digital-twin/identity/goals (and any other identity read that consults MortalLoom iCloud sync) 500'd with Unknown system error -11, read when the MortalLoom.json file in the iCloud ubiquity container was momentarily unreadable — typically while iCloud was mid-sync, downloading, or resolving a conflict. readStore() and getStatus() in server/services/mortalLoomStore.js now catch the transient readFile/stat failure, log a single warning with the errno, and return null / a null-summary response (matching the existing "file not present yet" path). ENOENT races between existsSync and readFile/stat (file disappears mid-call) are treated as silently absent rather than transient — no warning noise, and getStatus() reports exists:false instead of falsely reporting exists:true,size:0. updateStore() resolves the path once and threads it through both the read and the write so a settings change mid-call can't desync the overwrite guard from the actual write target; it also refuses to overwrite when the parsed store isn't a plain object (array/primitive) so JSON.stringify can't silently drop named properties. Read consumers (mlArrayIfEnabled, mlGetProfileIfEnabled, readDailyLogIfEnabled, mlIdAtDateIndex) already handled null as "fall through to local PortOS data," so the goals endpoint now serves local data instead of 500ing.