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 remote-tracking branch 'origin/main' into claim/issue-2417

Adam Eivyb33415c97698
diff --cc .changelog/NEXT.md
index e1eef1b8a2,67c002ba41..7df61a0e06
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@@ -6,10 -16,18 +16,20 @@@
- **Shell page quick-command buttons trimmed to the interactive tools.** Dropped the four shell one-liner shortcuts (`git status`, `git pull`, `npm test`, `npm run dev`) that duplicated things you'd just type, renamed the `antigravity` button to its actual command `agy`, and added a `grok` button alongside the other coding-agent launchers.
+ - **Image and video generators now share one resolution control (#2436).** The image (`ImageGenControls`) and video (`VideoGen`) size pickers had diverged into two separate "preset dropdown + custom W×H" implementations over the same helper tables — and VideoGen rendered its Width/Height inputs twice. Both now consume a single `components/media/ResolutionField.jsx` (preset `<select>` + a "Custom…" sentinel that reveals gated Width/Height inputs with a blur-clamp), and `clampImageEdge` in `imageGenResolutions.js` is generalized to accept `{ min, max, step }` so video reuses it (clamping to 64–2048 and snapping to the multiple-of-64 grid the server floors to). The controls mirror their routes: the image edge inputs use `step=1` (its route accepts any integer edge, so a hand-typed 705 no longer trips the form's native step validation), while video keeps `step=64` and snaps on blur. Cleanup deferred from the custom-image-dimensions slice.
+
+ - **Recurring CoS agent failures now fold themselves into human-readable "Standing Learnings" the failure path writes automatically (#2443).** CoS learnings previously fed only machinery (routing, cooldowns, skip-gating) — the one prose channel, `recordLearningInsight`, was invoked solely from a manual API route, so no incident ever became a readable operating note. Now, when a single error category recurs to a milestone (3, 10, 25, 50, 100 occurrences), `recordTaskCompletion` auto-records a provenance-stamped insight — timestamp, originating agent id, error category, task type, recurrence count, and provider/model attribution — built only from controlled fields (never the raw error message, so no path/PII leaks). Auto-flagged incidents are distinguished from user-authored notes (`origin: 'auto-incident'` vs `'user'`) and surfaced in a new collapsible **Standing Learnings** panel on the CoS Learning tab. All runtime-only (`data/cos/learning.json`) — nothing is committed to git or federated. Milestone matching is exact so each threshold fires once and escalates rather than spamming.
+
## Fixes
+- **Privacy broker case actions are now rendered from the server's state machine, so the UI can't offer an illegal transition.** The drawer and the human-task digest strip used to decide which manual buttons to show from a hand-mirrored client map (`MANUAL_DONE_ACTION`) of the server's `STATE_TRANSITIONS` — a copy that could silently drift (the original bug: a "Mark submitted" button on blocked cases, where `blocked → submitted` is not a legal transition, so it always failed). Case payloads and digest items now carry a server-derived `allowedTransitions` list (computed from the same rules `assertTransition` enforces, folding in the any-state `human_task_queued` special case and excluding the rescan-only `confirmed_removed`/`reappeared` targets a human can't initiate). Both action strips render from a shared `state → { target, label, tone }` presentation table (`CASE_ACTIONS`, labels/tones stay UI concerns) filtered by that list, so an action whose target the server doesn't consider legal structurally cannot render.
+
+ - **Generated agent prompts (swarm, scheduled claim-work, other queued system tasks) no longer double-print their first line.** A task queued through the CoS improvement/claim-work path is persisted to `COS-TASKS.md` by moving its full multi-line prompt into `metadata.context` and keeping only the first line as `description` (so the markdown stays one-line-per-task). Coming back out, `context` therefore led with a verbatim copy of `description`, and every prompt-render path emitted both — so a swarm run opened with the header twice (`# ⚡ SWARM MODE …`, then `### Context`, then `# ⚡ SWARM MODE …` again, the whole body repeated). A new `reconcileSplitContext` step in `agentPromptBuilder.js` detects that exact split signature (context's first non-empty line equals `description`), folds the body back into `description`, and drops the redundant `metadata.context` — so the prompt renders once as one clean body with no spurious `### Context` wrapper. A genuinely-separate user-supplied context (whose first line differs from the description) is left untouched, and the stored task keeps its one-line description for the task-list UI. Pure code fix — reaches every install on update, no data or prompt-template migration.
+
+ - **The CoS agent briefing no longer prints a redundant "Target Application" heading for the PortOS default app on the api-prompt path (#2430).** The light/fallback prompt path already suppressed the target-app line for `portos-default` (the agent runs in the PortOS directory, so it adds nothing), but the editable `cos-agent-briefing` stage template still rendered the heading for any task carrying an app id. The template now gates the stock heading on a precomputed `targetAppLabel` (empty for the default app, the app id for managed apps) that `agentPromptBuilder.js` threads into the render context — mirroring `buildTaskBlock`'s predicate — while leaving `task.metadata.app` in the context untouched for any custom template references. Ships as stage-prompt migration 187 (hash-matched, cross-synced with 010's accepted-hash chain) so unmodified installs auto-upgrade and customized copies are left alone.
+
+ - **Layered Intelligence's outcome feedback loop now reconciles the `plan` (PLAN.md) tracker too (#2435).** After #2428 closed the loop for forge (gh/glab) and jira trackers, the `plan` tracker stayed excluded because `readIssues` mapped every `[lil-*]` PLAN.md item to `state: 'open'` regardless of its `- [ ]` / `- [x]` checkbox, so a completed proposal could never resolve. `extractPlanSlugs` now preserves each item's checkbox state — a checked `- [x]` reads `closed` (which `deriveOutcome` maps to *merged*) and an unchecked `- [ ]` (or a bare tag with no checkbox — absent ≠ done) reads `open` — so a checked item both reconciles as an outcome and falls out of the dedup window to become re-proposable, while open items stay suppressed as before. The `outcomesTrackerSupported()` gate now includes `plan`, so PLAN-tracked apps learn from their own merge rate like forge/jira apps.
+
- **Character Sheet name edits can no longer be reverted by a stale blur-save that fires while the prior save is still in flight (#2409).** Committing a name change (Enter or blur) starts a PUT and immediately returns the header to its button view. If you reopened the editor before that PUT landed, the reopened input seeded from the pre-save name — and a subsequent blur could persist that stale value straight back over the change you just made. The name trigger now disables while a save is in flight (tracked via a `nameSaving` flag set before the PUT and cleared in `finally`) and `startNameEdit` refuses to reopen until the save settles, so exactly one write wins and no stale revert can slip through.
- **HuggingFace model downloads (Flux and every other image/video/music pull) now log to the server console.** Triggering a base-model download showed a progress bar in the UI but left no trace in the server log — the entire download path emitted progress *only* over the SSE stream to the browser, and PortOS has no HTTP access logger, so a headless/PM2 log had no record the multi-GB fetch ever ran. The shared SSE driver (`server/lib/sseDownload.js#startHfDownloadStream`, the single chokepoint behind the image, video, and music download endpoints) now writes single-line, emoji-prefixed log lines for the start of each repo pull (`⬇️`, with a forced-re-fetch marker), each file as it streams, a cache hit that skips the download (`📦`), the outcome (`✅` complete with byte count / `❌` failed with the error message), and client-disconnect cancellation (`🛑`) — while cancelled results are deliberately not logged as failures.