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
import { request } from './apiCore.js';
// Human-activity timeline (#2150). Day view + filtered event list.
export const getTimelineDay = (options = {}) => {
const params = new URLSearchParams();
if (options.date) params.set('date', options.date);
const qs = params.toString();
return request(`/timeline/day${qs ? `?${qs}` : ''}`, { silent: options.silent });
};
// Bulk-backfill importers (#2160). Upload an export file (ZIP or single JSON).
// `preview: true` returns parse-only counts + a summary without writing; a real
// import is idempotent so re-imports are safe. request() detects the FormData
// body and lets the browser set the boundary.
const importFile = (path, file, { preview = false, fields = {}, ...options } = {}) => {
const formData = new FormData();
formData.append('file', file);
formData.append('preview', preview ? 'true' : 'false');
// Source-specific extra text fields (e.g. WhatsApp's `yourName`). Blank values
// are dropped so the server sees "not provided" rather than an empty string.
for (const [name, value] of Object.entries(fields)) {
if (value != null && String(value).trim() !== '') formData.append(name, String(value));
}
return request(path, { method: 'POST', body: formData, ...options });
};
// Spotify extended-history export (dedupe on played-at + track).
export const importSpotifyHistory = (file, options = {}) =>
importFile('/timeline/import/spotify', file, options);
// Google Takeout "Location History (Timeline)" semantic place visits (dedupe on
// visit-start + place identity).
export const importTakeoutLocationHistory = (file, options = {}) =>
importFile('/timeline/import/takeout-location', file, options);
// Discord "data package" — the messages you sent across every channel/DM
// (dedupe on the globally-unique Discord message snowflake id).
export const importDiscordHistory = (file, options = {}) =>
importFile('/timeline/import/discord', file, options);
// WhatsApp "Export chat" transcript (`_chat.txt`, standalone or zipped) — each
// message becomes a timeline event (dedupe on a content hash). An optional
// `yourName` classifies direction: a sender matching it → sent, others →
// received; absent → neutral `message` events. An optional `chatLabel` is a stable
// chat name that scopes the dedupe key so distinct chats don't collide.
export const importWhatsappHistory = (file, { yourName, chatLabel, ...options } = {}) =>
importFile('/timeline/import/whatsapp', file, { ...options, fields: { yourName, chatLabel } });
// Google Takeout Chrome browser history (`History.json`, standalone or zipped) —
// each visit becomes a `web.visit` event (dedupe on a content hash of
// visit-instant + URL). Subframe (iframe) loads are dropped server-side.
export const importBrowserHistory = (file, options = {}) =>
importFile('/timeline/import/browser', file, options);
// Google Takeout YouTube `watch-history.json` (standalone or zipped) — each watch
// becomes a `media.watch` event (dedupe on video id + local day, shared with the
// live scrape so the backfill and scrape reconcile).
export const importYoutubeHistory = (file, options = {}) =>
importFile('/timeline/import/youtube', file, options);
// Gmail full-history metadata (#2160). Google Takeout Gmail ships a multi-GB
// `.mbox` that doesn't fit the 200MB upload flow, so this importer is PATH-BASED:
// the server streams a local `.mbox` file (or the extracted `Takeout/Mail/` folder)
// the user names. Only header metadata + a short summary are stored — never the
// message body. Each message → a `message.sent`/`message.received` event under
// source `gmail` (dedupe on the RFC-822 Message-ID). `preview: true` streams +
// counts without writing; an optional `yourEmail` refines sent/received direction.
export const importGmailMbox = ({ path, preview = false, yourEmail, ...options } = {}) =>
request('/timeline/import/gmail', {
method: 'POST',
body: JSON.stringify({
path,
preview,
...(yourEmail && String(yourEmail).trim() ? { yourEmail } : {}),
}),
...options,
});
// Per-source event counts + date range, and user-driven erasure of one source.
export const getTimelineSources = (options = {}) =>
request('/timeline/sources', { silent: options.silent });
export const eraseTimelineSource = (source, { from, to, kind, silent } = {}) => {
const params = new URLSearchParams({ source });
if (from) params.set('from', from);
if (to) params.set('to', to);
if (kind) params.set('kind', kind);
return request(`/timeline/events?${params}`, { method: 'DELETE', silent });
};