Skip to content

desktop/src/lib/api.ts

Comment 1, line 1

desktop/src/lib/api.ts:1

/**
* Backend IPC types and wrappers. Large token integers use decimal strings; convert to
* number only for chart scaling, retaining strings for exact values.
*/

Comment 2, line 8

desktop/src/lib/api.ts:8

/** Tiered archive retention in days; yearly null means lifetime retention. */

Comment 3, line 20

desktop/src/lib/api.ts:20

/** null follows locale: Monday for zh, Sunday for en-US/CA. */

Comment 4, line 28

desktop/src/lib/api.ts:28

/** Theme: system, light or dark. */

Comment 5, line 32

desktop/src/lib/api.ts:32

/** Display alias for this source host; does not change host_id. */

Comment 6, line 34

desktop/src/lib/api.ts:34

/** F2 cost estimation, off by default and when absent from historical settings JSON. */

Comment 7, line 105

desktop/src/lib/api.ts:105

/** Provider pricing preferences; absent preferences allow only an unambiguous official API reference for the same model. */

Comment 8, line 110

desktop/src/lib/api.ts:110

/** Default cache-write TTL tier in minutes; null leaves that component unpriced. */

Comment 9, line 117

desktop/src/lib/api.ts:117

/** F2 models.dev catalog refresh, off by default and when absent from historical settings JSON. */

Comment 10, line 119

desktop/src/lib/api.ts:119

/** Online cache TTL: 1-365 days, default 3; fresh caches avoid network requests. */

Comment 11, line 123

desktop/src/lib/api.ts:123

/** Amount rows by currency in smallest units; keep currencies separate. */

Comment 12, line 140

desktop/src/lib/api.ts:140

/** Events priced through official-provider fallback when the recorded provider lacks an exact entry. */

Comment 13, line 191

desktop/src/lib/api.ts:191

/** Raw online-response cache metadata for displaying freshness. */

Comment 14, line 199

desktop/src/lib/api.ts:199

/** Refresh result: fetched, cache_fresh, fetch_failed_used_cache or fetch_failed_no_cache. */

Comment 15, line 217

desktop/src/lib/api.ts:217

/** Intended/actual system-task state; Windows checks due sources each minute. */

Comment 16, line 301

desktop/src/lib/api.ts:301

/** null means presence could not be checked; do not hide a real read failure. */

Comment 17, line 315

desktop/src/lib/api.ts:315

/** Registered files no longer on disk after Agent cleanup/compaction; only retained application history remains. */

Comment 18, line 317

desktop/src/lib/api.ts:317

/** Source collection schedule; null inherits the global interval (M6). */

Comment 19, line 334

desktop/src/lib/api.ts:334

/** Collection progress: 0-100 percent and estimated remaining seconds; null ETA means unavailable. */

Comment 20, line 337

desktop/src/lib/api.ts:337

/** Completed adapter names in completion order. */

Comment 21, line 361

desktop/src/lib/api.ts:361

/** v6 user list and currently selected statistics user. */

Comment 22, line 373

desktop/src/lib/api.ts:373

/** Row counts by retention layer and database bytes, including WAL. */

Comment 23, line 384

desktop/src/lib/api.ts:384

/** Aggregate exchange-package import counts (M1a). */

Comment 24, line 402

desktop/src/lib/api.ts:402

/** Manual tiered-cleanup result. */

Comment 25, line 411

desktop/src/lib/api.ts:411

/** Background clear-all start; started=false means a task is already running. */

Comment 26, line 416

desktop/src/lib/api.ts:416

/** Background clear-all-progress stages.
* waiting: wait for collection; backup: copy database; clearing: clear transaction;
* cleared: tables cleared with counts/backup path; rescan: full collection started;
* done: rescan finished; failed: stopped with error details; cancelled: cancellation acknowledged. */

Comment 27, line 429

desktop/src/lib/api.ts:429

/** Clear-all preview: event count and registered missing source files that cannot be recollected. */

Comment 28, line 436

desktop/src/lib/api.ts:436

/** event_details page row; token integers use decimal strings. */

Comment 29, line 459

desktop/src/lib/api.ts:459

/** Export user/host options and current values; is_current selects defaults. */

Comment 30, line 467

desktop/src/lib/api.ts:467

/** chart_series grouping dimension, queried directly from aggregate tables. */

Comment 31, line 470

desktop/src/lib/api.ts:470

/** Grouped time-series row; tokens are decimal strings or null for unknown. */

Comment 32, line 488

desktop/src/lib/api.ts:488

/** diagnostic_logs row; time is a millisecond timestamp. */

Comment 33, line 501

desktop/src/lib/api.ts:501

/** Generic quota snapshot; retain native units separately from recorded usage. */

Comment 34, line 576

desktop/src/lib/api.ts:576

/** Diagnostic logs: null code_filter selects all; a code string selects that category. */

Comment 35, line 580

desktop/src/lib/api.ts:580

/** Current API reference, model unit rates and curve; frozen history remains in the response. */

Comment 36, line 589

desktop/src/lib/api.ts:589

/** Background models.dev refresh/import; force=true bypasses cache TTL. */

Comment 37, line 611

desktop/src/lib/api.ts:611

/** Subscribe to background clear-all stages and return the unsubscribe callback. */

Comment 38, line 616

desktop/src/lib/api.ts:616

/** Generic quota overview; agent=null selects all, with native units separate from recorded usage. */

Comment 39, line 619

desktop/src/lib/api.ts:619

/** Daily quota trend for (agent, quota_id). */

Comment 40, line 624

desktop/src/lib/api.ts:624

/** Parse a backend JSON-string error containing code/message. */

Comment 41, line 631

desktop/src/lib/api.ts:631

/* Return the original string when JSON parsing fails. */