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

docs: update API reference and system resources JSDoc documentation

[._.]/ Adam Eivye83ca6e5f258
diff --git a/docs/API.md b/docs/API.md
index 35488423c4..4b25622599 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -535,23 +535,27 @@ Every mounted API prefix (see `server/index.js` for the authoritative list). Dom
| `/api/avatar` | Avatar rendering/config |
| `/api/system` | System health metrics |
| `/api/system/capabilities` | Local hardware capabilities for model/provider selection |
+| `/api/system-resources` | System storage report and AI-assisted cleanup triage |
| `/api/capabilities` | Feature capability flags |
| `/api/agent-context` | Opt-in, loopback-only read-only MCP context and runtime manifest |
| `/api/workspace-contexts` | Workspace context management |
| `/api/apps/:appId/reference-repos` | Per-app reference repos |
| `/api/network-exposure` | Network exposure checks |
+| `/api/history` | User/system action history log |
+| `/api/commands` | Allowlisted command execution |
| `/api/git` | Git operations for managed apps |
| `/api/screenshots` | Screenshot capture |
| `/api/search` | Global search |
| `/api/palette` | ⌘K command palette manifest + actions |
| `/api/dashboard/layouts` | Dashboard widget layouts |
-| `/api/media/collections`, `/api/media/annotations` | Media library collections/annotations |
+| `/api/dashboard/daily-actions` | Dashboard daily action tracking |
+| `/api/media/collections`, `/api/media/annotations`, `/api/media/sketches` | Media library collections/annotations/sketches |
| `/api/client-errors` | Client-side error reporting |
| `/api/backup` | Backup snapshots + restore |
| `/api/legacy-export` | Legacy data export |
| `/api/database` | Postgres introspection |
| `/api/image-clean` | Image metadata cleaning |
-| `/api/city` | CyberCity snapshots/introspection |
+| `/api/openworld`, `/api/city` | OpenWorld and CyberCity 3D snapshots/introspection |
| `/api/cos/gsd` | CoS GSD workflow |
| `/api/feature-agents` | Feature agent runs |
| `/api/feeds` | RSS/content feeds |
@@ -584,6 +588,7 @@ Every mounted API prefix (see `server/index.js` for the authoritative list). Dom
| `/api/video-timeline` | Video timeline editor |
| `/api/media-jobs` | Async media job queue |
| `/api/creative-director` | Creative Director projects |
+| `/api/fableloom` | FableLoom interactive story generation |
| `/api/music-video` | Music video projects |
| `/api/mood-boards` | Mood boards |
| `/api/writers-room` | Writers Room |
@@ -594,6 +599,7 @@ Every mounted API prefix (see `server/index.js` for the authoritative list). Dom
| `/api/importer` | Story importer |
| `/api/story-builder` | Story Builder |
| `/api/loras`, `/api/lora-datasets`, `/api/lora-training` | LoRA management/training |
+| `/sdapi/v1` | AUTOMATIC1111-compatible image generation surface (gated by `settings.imageGen.expose.a1111`) |
| `/api/openclaw` | OpenClaw operator chat |
| `/api/rounds` | Rounds (music + Morse training) |
| `/api/ask` | Ask (LLM Q&A) |
@@ -612,14 +618,14 @@ Every mounted API prefix (see `server/index.js` for the authoritative list). Dom
| `/api/scaffold` | App scaffolding |
| `/api/usage` | Provider usage / quota |
| `/api/daily-driver` | Daily-driver snapshot |
-| `/api/media/sketches` | Media annotation sketches |
| `/api/attachments` | Task / CoS file attachments |
| `/api/autofix` | Autofixer metrics |
| `/api/uploads` | Generic uploads |
| `/api/agents` | Agent process management (personalities, accounts, schedules, activity, tools) |
+| `/api/agents/tools/moltworld`, `/api/agents/tools/moltworld/ws` | MoltWorld agent tools and WebSocket |
| `/api/cos` | Chief of Staff |
| `/api/memory` | Memory CRUD / search |
-| `/api/brain` | Brain (second brain) |
+| `/api/brain`, `/api/brain/import` | Brain (second brain) and document import |
| `/api/media` | Media library |
| `/api/imessage`, `/api/contacts`, `/api/signal`, `/api/spotify`, `/api/youtube` | Personal-data ingest |
| `/api/notifications` | Notification stream |
diff --git a/server/services/systemResources.js b/server/services/systemResources.js
index 8f3d0e5f6d..16d1ef7af0 100644
--- a/server/services/systemResources.js
+++ b/server/services/systemResources.js
@@ -132,6 +132,15 @@ function modelCleanupCandidates(downloaded) {
}));
}
+/**
+ * Build a sorted array of cleanup candidates from data categories, downloaded models, and package caches.
+ *
+ * @param {Object} options
+ * @param {Array<Object>} options.categories Data categories from dataManager
+ * @param {Array<Object>} options.downloadedModels Model inventory objects
+ * @param {number|null} options.npmCacheBytes Size of npm cache in bytes
+ * @returns {Array<Object>} Sorted cleanup candidates by estimated size descending
+ */
export function buildCleanupCandidates({ categories, downloadedModels, npmCacheBytes }) {
const candidates = [
...dataCleanupCandidates(categories),
@@ -546,6 +555,13 @@ export function resetSystemResourceReportCache() {
reportInFlight = null;
}
+/**
+ * Fetch or compute the cached system resource report.
+ *
+ * @param {Object} [options]
+ * @param {boolean} [options.force=false] Force bypassing the 30-second report cache
+ * @returns {Promise<Object>} System resource report containing storage breakdown, queues, and cleanup candidates
+ */
export function getSystemResourceReport({ force = false } = {}) {
if (!force && reportCache && Date.now() - reportCacheAt < REPORT_CACHE_TTL_MS) {
return Promise.resolve(reportCache);
@@ -575,6 +591,7 @@ export function buildSystemResourceTriagePrompt(report) {
kind: candidate.kind,
estimatedBytes: candidate.estimatedBytes,
risk: candidate.risk,
+ reason: candidate.reason,
loaded: candidate.loaded,
busy: candidate.busy,
manualOnly: candidate.manualOnly,
@@ -604,6 +621,17 @@ SYSTEM REPORT (no filesystem paths or personal filenames):
${JSON.stringify(context, null, 2)}`;
}
+/**
+ * Perform AI-assisted system storage triage based on the current system resource report.
+ *
+ * @param {Object} [options]
+ * @param {string} [options.providerId] AI provider identifier
+ * @param {string} [options.model] Specific AI model to use
+ * @param {string} [options.effort] Effort level for supported reasoning models
+ * @param {Function} [options.onRunCreated] Callback invoked when an AI run is spawned
+ * @param {Function} [options.onRunSettled] Callback invoked when an AI run settles
+ * @returns {Promise<Object>} Triage result containing structured recommendations and cautions
+ */
export async function triageSystemResources({
providerId,
model,