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
fix: confirm before deleting an image or video from preview cards
[._.]/ Adam Eivyc45f61286ea3
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 1cdd19ac20..e5b514bd2f 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -7,6 +7,7 @@## Fixed- **Client test suite no longer floods CI with React "not wrapped in act(...)" warnings.** Across eight component/page suites, state updates were being driven outside `act()` — hand-fired mock-EventSource frames (`emit`/`fail`), raw DOM `.blur()` calls, manually-invoked tracker callbacks, and resolved in-flight gates whose follow-up `setState` landed after the test body returned (plus a few synchronous tests whose mount-time fetches resolved late). These surfaced only under CI's verbose reporter (the default reporter hides console output), so they were invisible locally. Each driving call is now wrapped in `act()` (or switched to `fireEvent`, which wraps internally), and synchronous tests that mount components with async effects now flush inside `act()`. The full client suite (2497 tests) runs clean with zero act warnings. (`PipelineManuscriptEditor`, `Layout`, `WidgetSuggestions`, `ApiAccessTab`, `PitchTuner`, `SongTraining`, `AudioStage`, `LocalLlmPlayground` test suites)+- **Deleting a generated image or video now asks for confirmation.** The trash button on image/video preview cards (the Image Gen page's recent-renders strip and the Media History grid) deleted the asset immediately on a single click, with no undo. It now arms an inline confirm row ("Delete this image?" / "Delete this video?" with Delete + Cancel) so an accidental click can't wipe a render. Fixed once in the shared `MediaCard` component, so both surfaces are covered. (`client/src/components/media/MediaCard.jsx`)- **Codex TUI CoS agents no longer get stuck in the sandbox.** The shipped Codex TUI provider pinned `--ask-for-approval never`, which silences approval prompts but leaves Codex's *sandbox* at its default (`workspace-write`) — so headless agents couldn't reach the network (`gh`/`npm`/`git fetch` failed) and could still hit surprise escalation prompts mid-run. Because an explicit `--ask-for-approval` flag also suppressed the auto-injected full-bypass, the shipped default actively defeated the headless posture the CLI codex path already uses. The default now ships `--dangerously-bypass-approvals-and-sandbox` (approvals off + sandbox off + network on), and migration 121 rewrites existing installs whose args still match the old default — custom Codex flags are left untouched.- AI provider context-window planning is now model-aware: known Claude model windows are used after explicit provider overrides and before local `num_ctx`, and the provider settings UI shows/edits the planning window so mixed-model providers no longer collapse to one blunt 128K budget.- **AI fixers can no longer take down the whole server with `pm2 kill`.** PortOS runs every managed app under one shared pm2 daemon, so `pm2 kill` / `pm2 delete all` stops *everything* — including PortOS itself. A "Fix with AI" / autofixer agent (which runs its CLI fully unrestricted) could be talked into running one while trying to "restart the app." Three layers now block this: (1) the shell-command allowlist (`validateCommand`) rejects `pm2 kill`/`startup`/`unstartup` and any `pm2 <verb> all` for the manual command runner and autonomous jobs; (2) spawned AI agents (CoS tasks, the autofixer app) get a guarded `pm2` shim prepended to their PATH that intercepts those same destructive subcommands before they reach the real pm2 — a hard guard that holds even under `--dangerously-skip-permissions`; (3) every agent prompt now states the shared-daemon rule and to only `pm2 restart <its-own-process>`. Scoped commands (`pm2 restart my-app`, `pm2 logs my-app`, `pm2 list`) still work.diff --git a/client/src/components/media/MediaCard.jsx b/client/src/components/media/MediaCard.jsxindex 041882b6f2..18f413b63d 100644--- a/client/src/components/media/MediaCard.jsx+++ b/client/src/components/media/MediaCard.jsx@@ -1,7 +1,9 @@+import { useState } from 'react';import { Trash2, Download, Film, Image as ImageIcon, Sparkles, Eye, EyeOff, Maximize2, Wand2, Star, MessageSquare } from 'lucide-react';import MediaImage from '../MediaImage';import AddToCollectionMenu from './AddToCollectionMenu';import PinToMoodBoardMenu from './PinToMoodBoardMenu';+import InlineConfirmRow from '../ui/InlineConfirmRow';import { loraDisplayName } from './normalize';// Single card used everywhere a generated image/video appears in a grid:@@ -33,6 +35,7 @@ export default function MediaCard({const { kind, prompt, modelId, previewUrl, downloadUrl } = item;const isVideo = kind === 'video';const handleTileClick = onClick || (() => onPreview?.(item));+ const [confirmingDelete, setConfirmingDelete] = useState(false);return (<div className={`bg-port-card border rounded-xl ${selected ? 'border-port-accent' : 'border-port-border'}`}>@@ -111,7 +114,16 @@ export default function MediaCard({)}</div>)}- {!hideActions && (+ {!hideActions && confirmingDelete && onDelete && (+ <InlineConfirmRow+ question={`Delete this ${isVideo ? 'video' : 'image'}?`}+ confirmText="Delete"+ confirmTitle="Permanently delete"+ onConfirm={() => { setConfirmingDelete(false); onDelete(item); }}+ onCancel={() => setConfirmingDelete(false)}+ />+ )}+ {!hideActions && !confirmingDelete && (<div className="flex flex-wrap gap-1">{!isVideo && onRemix && (<button@@ -187,7 +199,7 @@ export default function MediaCard({{onDelete && (<buttontype="button"- onClick={() => onDelete(item)}+ onClick={() => setConfirmingDelete(true)}className="shrink-0 px-1.5 py-1 bg-port-error/20 hover:bg-port-error/40 text-port-error text-[10px] rounded flex items-center justify-center"title="Delete">diff --git a/client/src/components/media/MediaCard.test.jsx b/client/src/components/media/MediaCard.test.jsxindex 75c1627be6..a33bf18bf6 100644--- a/client/src/components/media/MediaCard.test.jsx+++ b/client/src/components/media/MediaCard.test.jsx@@ -48,4 +48,31 @@ describe('MediaCard', () => {/^\/data\/images\/late\.png\?_t=/);});++ it('arms an inline confirm row before deleting instead of deleting on first click', () => {+ const onDelete = vi.fn();+ render(<MediaCard item={imageItem} onDelete={onDelete} showCollectionMenu={false} showMoodBoardMenu={false} />);++ // First click on the trash button arms confirmation — it must NOT delete yet.+ fireEvent.click(screen.getByTitle('Delete'));+ expect(onDelete).not.toHaveBeenCalled();+ expect(screen.getByText('Delete this image?')).toBeInTheDocument();++ // Confirming fires the delete with the item.+ fireEvent.click(screen.getByRole('button', { name: 'Delete' }));+ expect(onDelete).toHaveBeenCalledWith(imageItem);+ });++ it('lets the user cancel the delete confirmation without deleting', () => {+ const onDelete = vi.fn();+ render(<MediaCard item={imageItem} onDelete={onDelete} showCollectionMenu={false} showMoodBoardMenu={false} />);++ fireEvent.click(screen.getByTitle('Delete'));+ fireEvent.click(screen.getByRole('button', { name: 'Cancel' }));++ expect(onDelete).not.toHaveBeenCalled();+ expect(screen.queryByText('Delete this image?')).not.toBeInTheDocument();+ // Action row is restored, so the trash button is available again.+ expect(screen.getByTitle('Delete')).toBeInTheDocument();+ });});