본문으로 건너뛰기

Desktop (WG)

Grida Desktop is one host implementation of the agent RFC. These docs are delta-only — every fact here is something you cannot derive from the RFC because it depends on the Electron + macOS/Linux/Windows host shape.

For the abstract contract:

  • Agent system RFC — protocol, locked tools, sessions, capability surface, sandbox placement.
  • Grida bindings — how the locked tools, the filesystem backends, and the built-in subagents land in Grida.
  • Grida Gateway (GG) — the shipped no-key AI path: scoped-token federation → metered first-party gateway → org-credit spend. BYOK still bypasses it.

For the user-facing app and the security boundary:

Pages

PageCovers
Process modelElectron main / socketless AgentSidecar / renderer — main-owned loopback, connected-socket capability transfer, provider frames, and the composed server.
Renderer bridgeURL-loaded renderer doctrine — loadURL("grida.co/desktop/*"), path-scoped window.grida, DesktopBridgeGate.
Resource loadingHow the renderer gets host-owned resource bytes — buffered (data:) vs streamed (privileged grida-workspace: scheme), Range/seeking, proxy-not-new-authority.
Agent securityDesktop binding of GRIDA-SEC-004: bridge path scope, HTTP perimeter, sandbox, and secrets discipline.
Desktop agent authorityThe Desktop delta for contained host services, native host networking, per-principal raw execution, and permission modes above confinement.
Agent storage layoutAgent-home files and SQLite session storage, separated from native Desktop preferences.

God class

The desktop's agent system is wired by one composed servercreateAgentDaemon (DaemonServer + the agent tenant) in packages/grida-daemon/src/daemon-server.ts. It owns the lifetime of every long-lived service: sessions store, stream registry, provider registry, workspace registry, secrets, files, shell, runtime. Public API: constructor(opts) / start({ listen? }) / fetch(Request) / stop(). HTTP routes are thin wrappers — business logic lives behind the class. The Electron-side agent-sidecar-supervisor.ts spawns it; the renderer-side chat seam in editor/lib/agent-chat coordinates today's use-chat-session, bridge transport, and refresh-on-stream-end wiring.

Three orchestrator files; everything else is a small collaborator with one job.