Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
/**
* Typed client for the Contacts REST API (dodaios/ui/web/contacts_routes.py).
* Plain fetch + useState/useEffect (no React Query), matching SocialsView /
* ProfileView.
*/
import type { Relationship } from "./constants";
export interface ContactAddress {
street?: string;
postal_code?: string;
city?: string;
country?: string;
}
/** Compact shape returned by the list endpoint. */
export interface ContactSummary {
slug: string;
name: string;
aliases: string[];
relationship: Relationship | null;
favorite: boolean;
organization: string | null;
tags: string[];
primary_email: string | null;
primary_phone: string | null;
email_count: number;
phone_count: number;
}
/** Full record returned by GET /{slug}, POST, PATCH. */
export interface Contact {
slug: string;
name: string;
aliases: string[];
relationship: Relationship | null;
favorite: boolean;
birthday: string | null;
organization: string | null;
role: string | null;
urls: string[];
tags: string[];
emails: string[];
phones: string[];
address: ContactAddress;
note: string;
primary_email: string | null;
primary_phone: string | null;
last_updated: string | null;
}
/** Body for create/update (PATCH sends only the changed keys). */
export interface ContactInput {
name: string;
aliases: string[];
relationship: Relationship | null;
favorite: boolean;
birthday: string | null;
organization: string | null;
role: string | null;
urls: string[];
tags: string[];
emails: string[];
phones: string[];
address: ContactAddress;
note: string;
}
/** Result of POST /import (merge semantics live server-side). */
export interface ImportStats {
ok: boolean;
created: number;
updated: number;
skipped: number;
errors: string[];
}
const BASE = "/api/contacts";
async function asError(res: Response): Promise<never> {
let detail = `${res.status} ${res.statusText}`;
try {
const body = (await res.json()) as { detail?: unknown };
if (typeof body.detail === "string") detail = body.detail;
} catch {
/* non-JSON body — keep the status line */
}
throw new Error(detail);
}
export async function listContacts(): Promise<ContactSummary[]> {
const res = await fetch(BASE);
if (!res.ok) return asError(res);
const data = (await res.json()) as { contacts?: ContactSummary[] };
return data.contacts ?? [];
}
export async function getContact(slug: string): Promise<Contact> {
const res = await fetch(`${BASE}/${encodeURIComponent(slug)}`);
if (!res.ok) return asError(res);
return (await res.json()) as Contact;
}
export async function createContact(input: ContactInput): Promise<Contact> {
const res = await fetch(BASE, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(input),
});
if (!res.ok) return asError(res);
return (await res.json()) as Contact;
}
export async function updateContact(
slug: string,
patch: Partial<ContactInput>,
): Promise<Contact> {
const res = await fetch(`${BASE}/${encodeURIComponent(slug)}`, {
method: "PATCH",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(patch),
});
if (!res.ok) return asError(res);
return (await res.json()) as Contact;
}
export async function deleteContact(slug: string): Promise<void> {
const res = await fetch(`${BASE}/${encodeURIComponent(slug)}`, { method: "DELETE" });
if (!res.ok) return asError(res);
}
export async function importVcf(vcf: string): Promise<ImportStats> {
const res = await fetch(`${BASE}/import`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ vcf }),
});
if (!res.ok) return asError(res);
return (await res.json()) as ImportStats;
}
/** The whole book as a .vcf blob (caller triggers the download). */
export async function exportVcf(): Promise<Blob> {
const res = await fetch(`${BASE}/export`);
if (!res.ok) return asError(res);
return res.blob();
}