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

refactor: import the upload orchestration from services/apiMedia and drop the fileUpload re-export shim (#3452)

[._.]/ Adam Eivy1a805dd65f8e
diff --git a/client/src/components/cos/TaskAddForm.jsx b/client/src/components/cos/TaskAddForm.jsx
index bfcd2d7857..eb3e874800 100644
--- a/client/src/components/cos/TaskAddForm.jsx
+++ b/client/src/components/cos/TaskAddForm.jsx
@@ -3,7 +3,8 @@ import { Plus, Image, X, ChevronDown, ChevronRight, Sparkles, Loader2, Paperclip
import toast from '../ui/Toast';
import AppContextPicker from '../AppContextPicker';
import * as api from '../../services/api';
-import { processScreenshotUploads, processAttachmentUploads, ATTACHMENT_ACCEPT } from '../../utils/fileUpload';
+import { processScreenshotUploads, processAttachmentUploads } from '../../services/apiMedia';
+import { ATTACHMENT_ACCEPT } from '../../utils/fileUpload';
import FilePickerButton from '../ui/FilePickerButton';
import { formatBytes } from '../../utils/formatters';
import { filterSelectableModels, isTuiProvider, isCliProvider, isProcessProvider, isCodexProvider } from '../../utils/providers';
diff --git a/client/src/components/cos/tabs/ResumeAgentModal.jsx b/client/src/components/cos/tabs/ResumeAgentModal.jsx
index b6efe0cede..579d3374e1 100644
--- a/client/src/components/cos/tabs/ResumeAgentModal.jsx
+++ b/client/src/components/cos/tabs/ResumeAgentModal.jsx
@@ -1,6 +1,6 @@
import { useState, useRef } from 'react';
import { X, CheckCircle, AlertCircle, RotateCcw, Image, Loader2 } from 'lucide-react';
-import { processScreenshotUploads } from '../../../utils/fileUpload';
+import { processScreenshotUploads } from '../../../services/apiMedia';
import toast from '../../ui/Toast';
import Modal from '../../ui/Modal';
import FilePickerButton from '../../ui/FilePickerButton';
diff --git a/client/src/components/universe/VisionDescribeModal.jsx b/client/src/components/universe/VisionDescribeModal.jsx
index 07e1316471..07c32345c9 100644
--- a/client/src/components/universe/VisionDescribeModal.jsx
+++ b/client/src/components/universe/VisionDescribeModal.jsx
@@ -25,7 +25,7 @@ import toast from '../ui/Toast';
import GalleryImagePicker from '../imageGen/GalleryImagePicker';
import VisionProviderPicker from './VisionProviderPicker';
import { useAsyncAction } from '../../hooks/useAsyncAction';
-import { processScreenshotUploads } from '../../utils/fileUpload';
+import { processScreenshotUploads } from '../../services/apiMedia';
import { describeEntityFromImages, expandEntityFromImages } from '../../services/apiUniverseBuilder';
// Mirror server VISION_MAX_IMAGES so the UI stops the user before the request
diff --git a/client/src/components/universe/VisionDescribeModal.test.jsx b/client/src/components/universe/VisionDescribeModal.test.jsx
index a6ed8f7de0..502b77a72c 100644
--- a/client/src/components/universe/VisionDescribeModal.test.jsx
+++ b/client/src/components/universe/VisionDescribeModal.test.jsx
@@ -20,7 +20,7 @@ vi.mock('../imageGen/GalleryImagePicker', () => ({ default: () => null }));
vi.mock('../ProviderModelSelector', () => ({ default: () => null }));
// Stub the upload helper so adding an image enables the actions without real I/O.
-vi.mock('../../utils/fileUpload', () => ({
+vi.mock('../../services/apiMedia', () => ({
processScreenshotUploads: vi.fn(async (files, { onSuccess }) => {
onSuccess({ filename: 'up.png', preview: 'data:image/png;base64,x' });
}),
diff --git a/client/src/pages/RunnerPage.jsx b/client/src/pages/RunnerPage.jsx
index 7540ea9fc7..bc5bd89823 100644
--- a/client/src/pages/RunnerPage.jsx
+++ b/client/src/pages/RunnerPage.jsx
@@ -5,7 +5,7 @@ import toast from '../components/ui/Toast';
import FilePickerButton from '../components/ui/FilePickerButton';
import * as api from '../services/api';
import socket from '../services/socket';
-import { processScreenshotUploads } from '../utils/fileUpload';
+import { processScreenshotUploads } from '../services/apiMedia';
import { filterSelectableModels } from '../utils/providers';
export function RunnerPage() {
diff --git a/client/src/services/README.md b/client/src/services/README.md
index 7efbf3e8d7..5564f482c1 100644
--- a/client/src/services/README.md
+++ b/client/src/services/README.md
@@ -93,7 +93,7 @@ toasts on throw). **Custom catch ⇒ `silent: true`** — otherwise toasts fire
|---|---|
| `apiImageVideo.js` | Image-gen local backend extras (gallery, models, LoRAs, cancel, delete). |
| `apiLoraTraining.js` | Character LoRA training — datasets (CRUD, upload, generate, slice, caption), training runs (start/list/cancel/delete + status), character→LoRA link lookup. |
-| `apiMedia.js` | Screenshots + media assets. Also owns the multi-file upload orchestration — `processScreenshotUploads` / `processAttachmentUploads` and their single-file variants (`uploadScreenshotFile` / `uploadAttachmentFile`) — moved from `utils/fileUpload.js` since they perform network I/O, not pure transforms. |
+| `apiMedia.js` | Screenshots + media assets. Also owns the multi-file upload orchestration — `processScreenshotUploads` / `processAttachmentUploads` and their single-file variants (`uploadScreenshotFile` / `uploadAttachmentFile`) — moved from `utils/fileUpload.js` since they perform network I/O, not pure transforms. `utils/fileUpload.js` keeps only the pure helpers/constants and no longer re-exports these. |
| `apiMediaJobs.js` | Media generation job tracking. |
| `apiCreativeDirector.js` | Creative Director (video production). |
| `apiCreativeCommission.js` | Creative Commissions (Autonomous Creation Engine — standing recurring briefs). |
diff --git a/client/src/utils/README.md b/client/src/utils/README.md
index df03b870d3..52b7602b90 100644
--- a/client/src/utils/README.md
+++ b/client/src/utils/README.md
@@ -54,7 +54,7 @@ grep -i "what you want to do" client/src/utils/README.md
| Module | Purpose |
|---|---|
-| `fileUpload` | Pure screenshot/attachment upload helpers: base64 read (`readFileAsBase64`) and image validation (`validateImageFile`). Also the shared upload constants — `JSON_UPLOAD_MAX_FILE_SIZE` (max file size / wire limit, mirrors `server/lib/uploadLimits.js`), `ATTACHMENT_MAX_FILE_SIZE`, `ALLOWED_ATTACHMENT_EXTENSIONS`, and the `accept` strings `ATTACHMENT_ACCEPT` / `IMAGE_ACCEPT`. The actual upload orchestration (`processScreenshotUploads` / `processAttachmentUploads` and their single-file variants) does network I/O and lives in `services/apiMedia.js`; re-exported here for backward compatibility. |
+| `fileUpload` | Pure screenshot/attachment upload helpers: base64 read (`readFileAsBase64`) and image validation (`validateImageFile`). Also the shared upload constants — `JSON_UPLOAD_MAX_FILE_SIZE` (max file size / wire limit, mirrors `server/lib/uploadLimits.js`), `ATTACHMENT_MAX_FILE_SIZE`, `ALLOWED_ATTACHMENT_EXTENSIONS`, and the `accept` strings `ATTACHMENT_ACCEPT` / `IMAGE_ACCEPT`. The actual upload orchestration (`processScreenshotUploads` / `processAttachmentUploads` and their single-file variants) does network I/O and lives in `services/apiMedia.js` — import those from there, not from here. |
## CyberCity — character & avatar
diff --git a/client/src/utils/fileUpload.js b/client/src/utils/fileUpload.js
index 9ff14b7439..765f1dee8d 100644
--- a/client/src/utils/fileUpload.js
+++ b/client/src/utils/fileUpload.js
@@ -5,8 +5,8 @@
* This module holds only pure helpers (base64 read, validation, constants) —
* no I/O. The upload orchestration that actually POSTs to the server
* (`uploadScreenshotFile` / `processScreenshotUploads` / `uploadAttachmentFile`
- * / `processAttachmentUploads`) lives in `../services/apiMedia.js` and is
- * re-exported below for backward compatibility with existing callers.
+ * / `processAttachmentUploads`) lives in `../services/apiMedia.js`; import it
+ * from there directly.
*/
import { formatBytes } from './formatters';
@@ -127,13 +127,3 @@ export function validateImageFile(file, maxFileSize = SCREENSHOT_MAX_FILE_SIZE)
// Max file size for attachments. Capped by the base64-in-JSON wire limit, not
// by any attachment-specific rule — see JSON_UPLOAD_MAX_FILE_SIZE.
export const ATTACHMENT_MAX_FILE_SIZE = JSON_UPLOAD_MAX_FILE_SIZE;
-
-// The upload orchestration (network I/O) lives in ../services/apiMedia.js —
-// re-exported here so existing callers that import these from utils/fileUpload
-// keep working without edits.
-export {
- uploadScreenshotFile,
- processScreenshotUploads,
- uploadAttachmentFile,
- processAttachmentUploads,
-} from '../services/apiMedia.js';