Open-source, local-first AI agent team for your desktop: multi-agent group chats, computer use, browser, MCP, routines and approvals. macOS, Windows, Linux + Android. Built on pi.
TypeScript agentai-agentai-agentsai-assistantandroidautomationchatgptcoding-agentcomputer-usedesktop-appelectronllmlocal-firstmcpmulti-agentollamaopenaiprivacyself-hostedtypescript
import { useState } from "react";
import { useMobile, useRuntime } from "../../runtime/context.tsx";
import { useAction } from "../../runtime/use-action.ts";
export function useDevices() {
const runtime = useRuntime(),
mobile = useMobile(),
action = useAction(mobile.selectedId, mobile.peer);
const [removing, setRemoving] = useState<string>();
return {
...mobile,
action,
removing,
setRemoving,
select: (id: string) => action.run(() => runtime.select(id)),
canKeepConnected: runtime.canKeepConnected(),
setKeepConnected: (on: boolean) => action.run(() => runtime.setKeepConnected(on)),
forget: () =>
action.run(async () => {
if (!removing) return;
try {
await runtime.forget(removing);
} catch {
throw new Error("forget_failed");
}
setRemoving(undefined);
}),
};
}