TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/miu-ll/Cody-assistant/llms.txt
Use this file to discover all available pages before exploring further.
window.desktop object is the contextBridge API that Cody’s Electron preload script (electron/preload/index.ts) exposes to every renderer window. Because Cody’s BrowserWindow instances run with sandbox: true, contextIsolation: true, and nodeIntegration: false, this bridge is the only way a renderer can communicate with the main process. Every method on window.desktop returns a Promise that resolves once the corresponding ipcRenderer.invoke call settles in the main process.
TypeScript users can augment the global
Window interface to get full type
safety. Import the types from src/types.ts and declare
window.desktop with the shape documented below.Data
Methods for loading and persisting the entire application state to disk.loadData
AppState from cody-data.json in the Electron userData directory. If the primary file is missing or corrupt, the main process automatically falls back to the daily backup (cody-data.backup.json). Returns null when no data exists yet (first launch).
Returns: Promise<AppState | null>
saveData
AppState to disk using an atomic write (write to a .tmp file then rename). Before writing, the main process takes a once-per-day backup of the previous file.
The complete application state to persist. The serialized JSON must not
exceed 5 MB — the main process rejects larger payloads with an error.
Promise<boolean> — true on success; throws on size-limit violations.
Notifications & Reminders
Methods for showing native Windows notifications and scheduling future alerts.notify
Notification API.
Notification title. Truncated to 180 characters; control characters are
stripped.
Notification body text. Same 180-character limit and sanitization as
title.Promise<boolean> — false if the platform does not support notifications.
Notifications are not suppressed in
focus mode — only dnd mode
suppresses them. See setFocus for details.scheduleReminder
reminder.at. If a reminder with the same id already exists, the previous timer is cancelled and replaced.
The reminder to schedule. See the
Reminder
type for the full field list. The at field must be a valid ISO 8601
date-time string in the future; past reminders return false immediately.Promise<boolean> — true if the timer was registered, false if the target time is already past or the payload failed validation.
cancelReminder
The unique reminder ID to cancel. Truncated to 120 characters.
Promise<boolean> — always true for trusted senders, even if no reminder with that ID was found.
Window Control
Methods for managing the assistant and pet windows from renderer code.openAssistant
BrowserWindow. Hides the pet window. If the assistant window does not yet exist it is created first.
Returns: Promise<boolean>
showPet
Promise<boolean>
minimizeWindow
minimize event fires and Cody automatically transitions back to the pet view.
Returns: Promise<boolean>
toggleMaximizeWindow
Promise<boolean> — false if the assistant window does not exist.
closeWindow
isQuitting is false during normal use, the close event is intercepted and the window transitions to the pet view rather than destroying itself.
Returns: Promise<boolean>
openExternal
shell.openExternal.
The URL to open. Must begin with
https:// — any other scheme is
rejected and the method returns false.Promise<boolean> — false if the URL does not pass the https:// check.
Pet Control
Methods for controlling the desktop pet widget — its context menu, drag behavior, and live state updates.showPetMenu
Promise<boolean>
startPetDrag
Promise<boolean> — only callable from the pet window; returns false from the assistant window.
movePetDrag
Promise<boolean> — false if no drag session is active or the call did not originate from the pet window.
endPetDrag
Promise<boolean> — resolves to true if the pet actually moved during the drag, false if the pointer never travelled far enough to be considered a drag (e.g. a click).
petUpdate
PetUpdate from the assistant window to the pet window. The main process forwards the payload via petWindow.webContents.send('pet-update', payload).
Either a
{ type: 'state' } mood/badge update or a { type: 'celebrate' }
celebratory animation trigger. See
PetUpdate.Promise<boolean> — false if the call does not originate from the assistant window (this channel is one-directional: assistant → pet).
Outlook Sync
syncOutlookClassic
electron/main/outlook and spawns a PowerShell script that reads the user’s calendar and inbox via the Outlook COM API. When an AiConfig is provided the sync pipeline runs AI classification on the inbox items.
Optional configuration object.
Promise<OutlookSyncResult> — see OutlookSyncResult.
This method is only meaningful on Windows with Outlook Classic (COM)
installed. It throws
Error('Origen no autorizado') if called from an
untrusted sender.File Operations
exportFile
defaultName and writes content to the path the user selects.
Suggested filename shown in the Save dialog. Path-traversal characters
(
<>:"/\|?* and control chars) are stripped via safeFileName() and the
result is capped at 120 characters.Text content to write. Must not exceed 10 MB in UTF-8 encoded size;
larger payloads return
null without opening the dialog.Promise<string | null> — the absolute file path written, or null if the user cancelled or the content exceeded the size limit.
exportDiagnostics
Promise<string | null> — the absolute path of the saved file, or null if the user cancelled.
App Info
getAppVersion
package.json (via app.getVersion()).
Returns: Promise<string> — e.g. "1.3.0".
setLaunchAtLogin
app.setLoginItemSettings.
true to register Cody to start with Windows; false to remove the
startup entry.Promise<boolean> — false in development builds (where the binary path would point to electron.exe rather than the installed app).
This method always returns
false in unpackaged development builds.
It only takes effect in a production build installed via the installer.Focus Mode
Methods for activating, deactivating, and querying Cody’s Focus and Do Not Disturb modes.setFocus
mode is null.
The focus mode to activate —
'focus' or 'dnd' — or null to
deactivate. See FocusMode.Duration in minutes. Clamped to the range 1–480. Ignored when
mode is null.Promise<boolean>
Focus vs DND behaviour
Focus vs DND behaviour
| Mode | Non-meeting reminders | Meeting reminders | Ad-hoc notifications |
|---|---|---|---|
focus | Suppressed | Delivered | Delivered |
dnd | Suppressed | Suppressed | Suppressed |
getFocus
Promise<FocusState | null> — a FocusState object when a session is active, or null when no focus session is running.
Event Subscriptions
These methods register listeners for events broadcast from the main process. Each returns an unsubscribe function — call it to remove the listener and avoid memory leaks.onShortcut
action string identifies the shortcut:
| Action | Shortcut | Description |
|---|---|---|
"new-task" | Win+Shift+T | Quick-add a new task |
"sync" | Win+Shift+S | Trigger an Outlook sync |
Called with the shortcut action string each time a hotkey fires.
() => void — call to unsubscribe.
onFocusChanged
setFocus(null, 0)).
Called with the new
FocusState, or
null when focus ends.() => void — call to unsubscribe.
onPetUpdate
PetUpdate via petUpdate(). Use this in the pet renderer to react to mood changes and celebration triggers.
Called with the
PetUpdate payload each
time the assistant pushes an update.() => void — call to unsubscribe.