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
address review (local): tear down zip stream on budget overflow, fix authors federation comments, preserve confidence 0
Adam Eivy6455909582a2
diff --git a/client/src/components/brain/tabs/ConfigTab.jsx b/client/src/components/brain/tabs/ConfigTab.jsxindex 2ceb8a2836..9c67f122a9 100644--- a/client/src/components/brain/tabs/ConfigTab.jsx+++ b/client/src/components/brain/tabs/ConfigTab.jsx@@ -62,7 +62,7 @@ export default function ConfigTab({ onRefresh }) {setSettings(settingsData);setSelectedProvider(settingsData.defaultProvider || '');setSelectedModel(settingsData.defaultModel || '');- setConfidenceThreshold(settingsData.confidenceThreshold || 0.6);+ setConfidenceThreshold(settingsData.confidenceThreshold ?? 0.6);setDailyDigestTime(settingsData.dailyDigestTime || '09:00');setWeeklyReviewDay(settingsData.weeklyReviewDay || 'sunday');setWeeklyReviewTime(settingsData.weeklyReviewTime || '16:00');diff --git a/server/lib/db.js b/server/lib/db.jsindex c605e5d1f3..aa8a33c668 100644--- a/server/lib/db.js+++ b/server/lib/db.js@@ -812,10 +812,11 @@ async function ensureSchemaImpl() {// sanitized record (name, writingStyle, bio, physicalDescription,// headshotStyle, headshotImageUrl) in `data` JSONB. `name` mirrors a column// for the live-list sort; the LWW/tombstone trio (updated_at/deleted/- // deleted_at) is populated FROM the record body. Authors are db-primary but- // LOCAL-ONLY for now (no sync_sequence/wire path) — a federated series keeps- // its denormalized `author` byline so peers still render the cover- // correctly. Mirrors the authors block in init-db.sql.+ // deleted_at) is populated FROM the record body. Authors are db-primary AND+ // federated via the per-record peer-sync push pipeline (record kind `author`,+ // sync category `authors`); a federated series also keeps its denormalized+ // `author` byline so a peer that hasn't synced the persona still renders the+ // cover correctly. Mirrors the authors block in init-db.sql.`CREATE TABLE IF NOT EXISTS authors (id TEXT PRIMARY KEY,name TEXT NOT NULL,diff --git a/server/scripts/init-db.sql b/server/scripts/init-db.sqlindex 57db2b6a32..e87499c395 100644--- a/server/scripts/init-db.sql+++ b/server/scripts/init-db.sql@@ -694,10 +694,11 @@ CREATE INDEX IF NOT EXISTS idx_universe_runs_universe ON universe_runs (universe-- sanitized record (name, writingStyle, bio, physicalDescription, headshotStyle,-- headshotImageUrl) in `data` JSONB. `name` mirrors a column for the live-list-- sort; the LWW/tombstone trio (updated_at/deleted/deleted_at) is populated FROM--- the record body. Authors are db-primary but LOCAL-ONLY for now (no--- sync_sequence/wire path) — a federated series keeps its denormalized `author`--- byline so peers still render the cover correctly. Mirrors the authors block in--- db.js ensureSchema().+-- the record body. Authors are db-primary AND federated via the per-record+-- peer-sync push pipeline (record kind `author`, sync category `authors`); a+-- federated series also keeps its denormalized `author` byline so a peer that+-- hasn't synced the persona still renders the cover correctly. Mirrors the+-- authors block in db.js ensureSchema().CREATE TABLE IF NOT EXISTS authors (id TEXT PRIMARY KEY,name TEXT NOT NULL,diff --git a/server/services/chatgptZipImport.js b/server/services/chatgptZipImport.jsindex 6d0a98b3da..233a009b41 100644--- a/server/services/chatgptZipImport.js+++ b/server/services/chatgptZipImport.js@@ -150,7 +150,18 @@ export async function extractChatgptZip(zipPath, { assetDir = PATHS.brainImportAawait new Promise((resolve, reject) => {let settled = false;- const settle = (fn) => (arg) => { if (!settled) { settled = true; fn(arg); } };+ const src = createReadStream(zipPath);+ const parser = parseZip();+ // On any error/settle, tear down both streams. Rejecting the Promise alone+ // doesn't stop ingestion — the read stream keeps flowing into the parser and+ // collect() keeps buffering members, so a charge() overflow would otherwise+ // exhaust the heap *after* the budget guard already fired, defeating it.+ const settle = (fn) => (arg) => {+ if (settled) return;+ settled = true;+ if (fn === reject) { src.destroy(); parser.destroy?.(); }+ fn(arg);+ };const onErr = settle(reject);const inFlight = [];// Charge buffered bytes against the aggregate budget the moment they land,@@ -164,9 +175,9 @@ export async function extractChatgptZip(zipPath, { assetDir = PATHS.brainImportAreturn buf;};- createReadStream(zipPath)+ src.on('error', onErr)- .pipe(parseZip())+ .pipe(parser).on('entry', (entry) => {const { path } = entry;if (IS_ASSET_NAME_MAP(path)) {