Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

29.8 KB
Raw Blame
export const PROTOCOL_VERSION = 11 as const;
export const SCHEMA_VERSION = 16 as const;
export const APP_ID = "net.aiuo.pi-desktop";
export const APP_NAME = "PI-Desktop";
export const APP_VERSION = "0.24.0-beta.6";

export const APP_MENU_COMMANDS = [
  "newTask",
  "openProject",
  "openSettings",
  "openSearch",
  "openCommandPalette",
  "toggleSidebar",
  "openHelp",
  "openLogs",
  "checkForUpdates",
  /** Brings the main window forward on the plugin market page (launcher empty
   * state, and any other surface that wants to send the user shopping). */
  "openPluginMarket",
] as const;

export type AppMenuCommand = (typeof APP_MENU_COMMANDS)[number];

export const NATIVE_MENU_ACTIONS = [
  "undo",
  "redo",
  "cut",
  "copy",
  "paste",
  "selectAll",
  "reload",
  "zoomIn",
  "zoomOut",
  "resetZoom",
  "toggleFullScreen",
  "minimize",
  "toggleMaximize",
  "close",
  "restoreMainWindow",
  "toggleMainWindow",
] as const;

export type NativeMenuAction = (typeof NATIVE_MENU_ACTIONS)[number];

export type WorkPanelTabMenuAction = "closeTab" | "closeOtherTabs" | "closeAllTabs";
export type WorkPanelTabMenuRequest = {
  closeTabLabel: string;
  closeOtherTabsLabel: string;
  closeAllTabsLabel: string;
  canCloseOthers: boolean;
  x: number;
  y: number;
};

export const WINDOW_CONTROL_ACTIONS = [
  "getState",
  "minimize",
  "toggleMaximize",
  "close",
] as const;

export type WindowControlAction = (typeof WINDOW_CONTROL_ACTIONS)[number];

export type LifecycleDialogKind = "quit-confirmation" | "close-behavior";
export type LifecycleDialogChoice = "cancel" | "confirm" | "tray" | "quit";
export type LifecycleDialogRequest = {
  requestId: string;
  kind: LifecycleDialogKind;
};
export type LifecycleDialogDismiss = { requestId: string };
export const IPC = {
  invoke: {
    storageGet: "pi-desktop/storage/get",
    storageChoose: "pi-desktop/storage/choose",
    storageMigrate: "pi-desktop/storage/migrate",
    storageClearCache: "pi-desktop/storage/clearCache",
    storageRemoveBackup: "pi-desktop/storage/removeBackup",
    appGetVersion: "pi-desktop/app/getVersion",
    appOpenFeedback: "pi-desktop/app/openFeedback",
    appHealth: "pi-desktop/app/health",
    appGetOnboarding: "pi-desktop/app/getOnboarding",
    appDismissOnboarding: "pi-desktop/app/dismissOnboarding",
    /**
     * Quit the whole application through the ordered shutdown. Exposed for the
     * surfaces that own the window while the shell has no data yet — a stuck
     * startup must always be able to exit the app (issue #831).
     */
    appQuit: "pi-desktop/app/quit",
    /** Installed system font families, resolved by Electron main. */
    systemFontsList: "pi-desktop/app/systemFonts",
    updatesGetState: "pi-desktop/updates/getState",
    updatesCheck: "pi-desktop/updates/check",
    updatesDownload: "pi-desktop/updates/download",
    updatesInstall: "pi-desktop/updates/install",
    updatesOpenReleases: "pi-desktop/updates/openReleases",
    /** Persist the user's decision to stop nudging about one version (#1317). */
    updatesDismiss: "pi-desktop/updates/dismiss",
    notificationList: "pi-desktop/notification/list",
    notificationMarkRead: "pi-desktop/notification/markRead",
    notificationMarkAllRead: "pi-desktop/notification/markAllRead",
    notificationClear: "pi-desktop/notification/clear",
    notificationShowNative: "pi-desktop/notification/showNative",
    notificationSetViewingSession: "pi-desktop/notification/setViewingSession",
    agentPrompt: "pi-desktop/agent/prompt",
    agentSteer: "pi-desktop/agent/steer",
    speechTranscribe: "pi-desktop/speech/transcribe",
    speechSynthesize: "pi-desktop/speech/synthesize",
    speechGetStatus: "pi-desktop/speech/getStatus",
    voiceStart: "pi-desktop/voice/start",
    voiceStop: "pi-desktop/voice/stop",
    voiceCancel: "pi-desktop/voice/cancel",
    voiceGetState: "pi-desktop/voice/getState",
    voiceGetDevices: "pi-desktop/voice/getDevices",
    voiceGetModels: "pi-desktop/voice/getModels",
    voiceDownloadModel: "pi-desktop/voice/downloadModel",
    voiceDeleteModel: "pi-desktop/voice/deleteModel",
    voiceUpdateSettings: "pi-desktop/voice/updateSettings",
    voiceCheckPermission: "pi-desktop/voice/checkPermission",
    voiceRequestPermission: "pi-desktop/voice/requestPermission",
    liveVoiceStatus: "pi-desktop/voice/live/status",
    liveVoicePrepare: "pi-desktop/voice/live/prepare",
    liveVoiceConnect: "pi-desktop/voice/live/connect",
    liveVoiceSetMuted: "pi-desktop/voice/live/setMuted",
    liveVoiceReportMedia: "pi-desktop/voice/live/reportMedia",
    liveVoiceReportPlayback: "pi-desktop/voice/live/reportPlayback",
    liveVoiceReportDelegation: "pi-desktop/voice/live/reportDelegation",
    liveVoiceReportControlApplied: "pi-desktop/voice/live/reportControlApplied",
    liveVoiceEnd: "pi-desktop/voice/live/end",
    liveVoiceHeartbeat: "pi-desktop/voice/live/heartbeat",
    liveVoiceResolveWorkSelection: "pi-desktop/voice/live/work/resolveSelection",
    liveVoiceStopWorkOperation: "pi-desktop/voice/live/work/stopOperation",
    liveVoiceCancelQueuedOperation: "pi-desktop/voice/live/work/cancelQueuedOperation",
    liveVoiceWidgetAction: "pi-desktop/voice/live/widget/action",
    liveVoiceWidgetOwnerState: "pi-desktop/voice/live/widget/ownerState",
    liveVoiceWidgetVisibility: "pi-desktop/voice/live/widget/visibility",
    /**
     * Computer use (ADR 0342, ADR 0344). The renderer may read capabilities,
     * read the live grant, and revoke it. It can neither mint nor act: the
     * grant is minted by main's tool handler against the host's own rules, and
     * `computer.act` is reachable only from that handler. Enumerating windows
     * is not a renderer channel either — nothing in the UI picks a target.
     */
    computerCapabilities: "pi-desktop/computer/capabilities",
    /** Ask the OS for the grant the platform needs; the user's click starts it. */
    computerRequestPermission: "pi-desktop/computer/permission/request",
    computerGrantRevoke: "pi-desktop/computer/grant/revoke",
    computerGrantDescribe: "pi-desktop/computer/grant/describe",
    agentCompact: "pi-desktop/agent/compact",
    agentAbort: "pi-desktop/agent/abort",
    agentStopSubagents: "pi-desktop/agent/stop-subagents",
    agentStop: "pi-desktop/agent/stop",
    agentQueuePush: "pi-desktop/agent/queue/push",
    agentQueueList: "pi-desktop/agent/queue/list",
    agentQueueRemove: "pi-desktop/agent/queue/remove",
    agentQueuePrioritize: "pi-desktop/agent/queue/prioritize",
    agentQueueReorder: "pi-desktop/agent/queue/reorder",
    agentGetStatus: "pi-desktop/agent/getStatus",
    agentInstructionsGet: "pi-desktop/agent/instructions/get",
    agentInstructionsSave: "pi-desktop/agent/instructions/save",
    sessionList: "pi-desktop/session/list",
    sessionCreate: "pi-desktop/session/create",
    sessionFork: "pi-desktop/session/fork",
    sessionMoveProject: "pi-desktop/session/moveProject",
    sessionSearch: "pi-desktop/session/search",
    sessionSearchContext: "pi-desktop/session/searchContext",
    sessionGet: "pi-desktop/session/get",
    sessionCollaboration: "pi-desktop/session/collaboration",
    sessionUsageCost: "pi-desktop/session/usageCost",
    /** Validate and select a durable session from a reviewed host operation. */
    sessionOpen: "pi-desktop/session/open",
    sessionDelete: "pi-desktop/session/delete",
    /** Isolated sessions in git worktrees (ADR 0329). */
    worktreeProbe: "pi-desktop/worktree/probe",
    worktreePreview: "pi-desktop/worktree/preview",
    worktreeMerge: "pi-desktop/worktree/merge",
    worktreePendingWork: "pi-desktop/worktree/pendingWork",
    /** "Sync from project": project commits the session lacks, and the sync. */
    worktreeBehind: "pi-desktop/worktree/behind",
    worktreeSync: "pi-desktop/worktree/sync",
    /** Behind counts of every isolated session, for the sidebar marker. */
    worktreeBehindAll: "pi-desktop/worktree/behindAll",
    worktreeSetupLog: "pi-desktop/worktree/setupLog",
    /** Opens the worktree folder in the OS file manager; no path is returned. */
    worktreeReveal: "pi-desktop/worktree/reveal",
    worktreeSetupCommandGet: "pi-desktop/worktree/setupCommand/get",
    worktreeSetupCommandSet: "pi-desktop/worktree/setupCommand/set",
    sessionRename: "pi-desktop/session/rename",
    /** Deterministic first-prompt title for a session that is still untitled. */
    sessionDeriveTitle: "pi-desktop/session/deriveTitle",
    sessionConfigure: "pi-desktop/session/configure",
    sessionImportScan: "pi-desktop/session/importScan",
    sessionImportRun: "pi-desktop/session/importRun",
    modelConfigImportScan: "pi-desktop/modelConfig/importScan",
    modelConfigImportRun: "pi-desktop/modelConfig/importRun",
    sessionDeleteMessage: "pi-desktop/session/deleteMessage",
    sessionRetractPendingPrompt: "pi-desktop/session/retractPendingPrompt",
    sessionReplaceMessages: "pi-desktop/session/replaceMessages",
    sessionSaveRevision: "pi-desktop/session/saveRevision",
    sessionListRevisions: "pi-desktop/session/listRevisions",
    sessionActivateRevision: "pi-desktop/session/activateRevision",
    sessionGetScratchPath: "pi-desktop/session/getScratchPath",
    sessionOpenScratchPath: "pi-desktop/session/openScratchPath",
    projectOpenFolder: "pi-desktop/project/openFolder",
    settingsGet: "pi-desktop/settings/get",
    settingsSet: "pi-desktop/settings/set",
    sidebarPreferencesGet: "pi-desktop/sidebar/preferences/get",
    sidebarPreferencesSet: "pi-desktop/sidebar/preferences/set",
    lanWebUiAdmin: "pi-desktop/lan-webui/admin",
    configSyncGetState: "pi-desktop/configSync/getState",
    backgroundTasksList: "pi-desktop/backgroundTasks/list",
    backgroundTasksOutput: "pi-desktop/backgroundTasks/output",
    backgroundTasksStop: "pi-desktop/backgroundTasks/stop",
    backgroundTasksCancelContinuation: "pi-desktop/backgroundTasks/cancelContinuation",
    configSyncConfigure: "pi-desktop/configSync/configure",
    configSyncTest: "pi-desktop/configSync/test",
    configSyncSyncNow: "pi-desktop/configSync/syncNow",
    configSyncPause: "pi-desktop/configSync/pause",
    configSyncUnlock: "pi-desktop/configSync/unlock",
    configSyncApprove: "pi-desktop/configSync/approve",
    configSyncReject: "pi-desktop/configSync/reject",
    configSyncMapProject: "pi-desktop/configSync/mapProject",
    configSyncListHistory: "pi-desktop/configSync/listHistory",
    configSyncRestore: "pi-desktop/configSync/restore",
    configSyncChangePassword: "pi-desktop/configSync/changePassword",
    configSyncDisconnect: "pi-desktop/configSync/disconnect",
    networkProxyTest: "pi-desktop/network/testProxy",
    commandShellList: "pi-desktop/commandShell/list",
    secretsSet: "pi-desktop/secrets/set",
    secretsDelete: "pi-desktop/secrets/delete",
    secretsHas: "pi-desktop/secrets/has",
    projectOpen: "pi-desktop/project/open",
    projectPickFolders: "pi-desktop/project/pickFolders",
    projectMemoryGet: "pi-desktop/project/memory/get",
    projectMemorySave: "pi-desktop/project/memory/save",
    projectGroupList: "pi-desktop/project-group/list",
    projectGroupCreateRemote: "pi-desktop/project-group/createRemote",
    projectGroupCreate: "pi-desktop/project-group/create",
    projectGroupRename: "pi-desktop/project-group/rename",
    projectGroupUpdate: "pi-desktop/project-group/update",
    projectGroupMemoryGet: "pi-desktop/project-group/memory/get",
    projectGroupMemorySave: "pi-desktop/project-group/memory/save",
    projectGroupInstructionsGet: "pi-desktop/project-group/instructions/get",
    projectGroupInstructionsSave: "pi-desktop/project-group/instructions/save",
    projectClone: "pi-desktop/project/clone",
    projectCloneCheckout: "pi-desktop/project/cloneCheckout",
    projectGet: "pi-desktop/project/get",
    projectList: "pi-desktop/project/list",
    projectSet: "pi-desktop/project/set",
    projectClear: "pi-desktop/project/clear",
    projectRemove: "pi-desktop/project/remove",
    scheduledList: "pi-desktop/scheduled/list",
    scheduledCreate: "pi-desktop/scheduled/create",
    scheduledUpdate: "pi-desktop/scheduled/update",
    scheduledDelete: "pi-desktop/scheduled/delete",
    scheduledRun: "pi-desktop/scheduled/run",
    scheduledExecute: "pi-desktop/scheduled/execute",
    scheduledListRuns: "pi-desktop/scheduled/listRuns",
    toolResolvePermission: "pi-desktop/tool/resolvePermission",
    todosGet: "pi-desktop/todos/get",
    askToolResolve: "pi-desktop/agent/askTool/resolve",
    plansPending: "pi-desktop/plans/pending",
    pendingInteractive: "pi-desktop/agent/pendingInteractive",
    plansResolve: "pi-desktop/plans/resolve",
    modesCatalog: "pi-desktop/modes/catalog",
    modesRead: "pi-desktop/modes/read",
    modesValidate: "pi-desktop/modes/validate",
    modesWrite: "pi-desktop/modes/write",
    modesDelete: "pi-desktop/modes/delete",
    modesRunGet: "pi-desktop/modes/run/get",
    modesRunControl: "pi-desktop/modes/run/control",
    modesRunUpdate: "pi-desktop/modes/run/update",
    modesRunResolve: "pi-desktop/modes/run/resolve",
    /**
     * New-format `mode.yaml` bundle surface (issue #2544): read every document a
     * map references, write them all or none, copy a whole mode directory, and
     * the mode's own `skills/` folder.
     */
    modesBundleRead: "pi-desktop/modes/bundle/read",
    modesBundleWrite: "pi-desktop/modes/bundle/write",
    modesCopy: "pi-desktop/modes/copy",
    modesBundleSettings: "pi-desktop/modes/bundle/settings",
    modesSkills: "pi-desktop/modes/skills",
    modesSkillsOpen: "pi-desktop/modes/skills/open",
    /**
     * List every paired remote `pi-host` this desktop knows, redacted so no
     * device token reaches the renderer. See ADR 0286 (R2b pairing UX).
     */
    remoteHostList: "pi-desktop/remoteHost/list",
    /**
     * Pair with a `pi-host` at `url` using a single-use `pairingToken`, mint
     * a device token, persist it encrypted, and open the live connection.
     */
    remoteHostPair: "pi-desktop/remoteHost/pair",
    /** Close the live connection for `hostKey` and drop its persisted record. */
    remoteHostRemove: "pi-desktop/remoteHost/remove",
    /**
     * Install and pair a `pi-host` on a machine the user reaches over SSH:
     * upload the bootstrap script, download and verify the published bundle
     * there, start the host, forward its loopback port, and exchange the
     * pairing token (spec §5.2). Uses the user's own SSH keys; no credential
     * crosses this channel.
     */
    remoteHostBootstrap: "pi-desktop/remoteHost/bootstrap",
    remoteHostReconnect: "pi-desktop/remoteHost/reconnect",
    remoteHostProjects: "pi-desktop/remoteHost/projects",
    remoteHostBrowseProjects: "pi-desktop/remoteHost/browseProjects",
    remoteHostRegisterProject: "pi-desktop/remoteHost/registerProject",
    remoteHostSessions: "pi-desktop/remoteHost/sessions",
    remoteHostCreateSession: "pi-desktop/remoteHost/createSession",
    remoteHostSyncProviders: "pi-desktop/remoteHost/syncProviders",
    providersList: "pi-desktop/providers/list",
    providersReorder: "pi-desktop/providers/reorder",
    providersCreate: "pi-desktop/providers/create",
    providersUpdate: "pi-desktop/providers/update",
    providersDelete: "pi-desktop/providers/delete",
    /**
     * Set or clear one provider's API key. Separate from `providersUpdate`
     * because a plugin-declared row refuses a generic update while still
     * needing the credential its declaration asks for.
     */
    providersSetSecret: "pi-desktop/providers/setSecret",
    providersTest: "pi-desktop/providers/testConnection",
    /**
     * Check a TypeSafe key before the Jev settings row keeps it.
     *
     * Jev is not a provider row, so `providersTest` cannot answer this: the
     * key is checked by the same System One round trip the Agent's
     * `JevClassify` tool makes, and only a key that answered is stored.
     */
    jevTest: "pi-desktop/jev/test",
    providersListModels: "pi-desktop/providers/listModels",
    /**
     * Look one model id up in the local models.dev snapshot.
     *
     * `providersListModels` cannot answer this: it describes a saved or
     * reached provider's catalogue, and a hand-typed custom id exists nowhere
     * yet when the settings picker needs its published limits. This is a
     * snapshot read — no provider network access and no host call — so the
     * picker can seed a custom row without probing an endpoint that does not
     * know the id.
     */
    providersLookupModel: "pi-desktop/providers/lookupModel",
    providersRefreshModelCatalog: "pi-desktop/providers/refreshModelCatalog",
    providersModelCatalogStatus: "pi-desktop/providers/modelCatalogStatus",
    providersOauthVendors: "pi-desktop/providers/oauth/vendors",
    providersOauthStart: "pi-desktop/providers/oauth/start",
    providersOauthRespond: "pi-desktop/providers/oauth/respond",
    providersOauthCancel: "pi-desktop/providers/oauth/cancel",
    providersOauthDelete: "pi-desktop/providers/oauth/delete",
    pluginList: "pi-desktop/plugin/list",
    /** A renderer slot component asking its own plugin for one JSON answer. */
    pluginRendererCall: "pi-desktop/plugin/rendererCall",
    /** Invoke a declared, user-facing Composer transform action. */
    pluginComposerTransform: "pi-desktop/plugin/composerTransform",
    /** Plugin-contributed agent extensions (D387/D388, ADR 0214). */
    pluginImportExtension: "pi-desktop/plugin/importExtension",
    extensionsCommandRun: "pi-desktop/extensions/commands/run",
    extensionsUiRespond: "pi-desktop/extensions/ui/respond",
    pluginLoadDev: "pi-desktop/plugin/loadDev",
    /**
     * The answer to a development plugin's permission review. Loading a folder
     * is a two-step: `pluginLoadDev` returns the declaration, and this commits
     * the permissions the user accepted.
     */
    pluginLoadDevConfirm: "pi-desktop/plugin/loadDevConfirm",
    pluginReload: "pi-desktop/plugin/reload",
    /** Commits a reviewed widening for an already-loaded development plugin. */
    pluginReloadConfirm: "pi-desktop/plugin/reloadConfirm",
    pluginCreateFromTemplate: "pi-desktop/plugin/createFromTemplate",
    pluginInstallFromPath: "pi-desktop/plugin/installFromPath",
    pluginInstallFromPackage: "pi-desktop/plugin/installFromPackage",
    pluginEnable: "pi-desktop/plugin/enable",
    pluginDisable: "pi-desktop/plugin/disable",
    pluginSetScope: "pi-desktop/plugin/setScope",
    pluginUninstall: "pi-desktop/plugin/uninstall",
    pluginSetAutoUpdate: "pi-desktop/plugin/setAutoUpdate",
    pluginSettingsGet: "pi-desktop/plugin/settings/get",
    pluginSettingsSet: "pi-desktop/plugin/settings/set",
    pluginOpenPanel: "pi-desktop/plugin/openPanel",
    pluginLauncherToggle: "pi-desktop/pluginLauncher/toggle",
    pluginLauncherDismiss: "pi-desktop/pluginLauncher/dismiss",
    pluginLauncherCatalog: "pi-desktop/pluginLauncher/catalog",
    pluginLauncherOpenApp: "pi-desktop/pluginLauncher/openApp",
    /** Content-driven window height, measured by the panel itself. */
    pluginLauncherContentHeight: "pi-desktop/pluginLauncher/contentHeight",
    /** Close the panel, focus the main window, and open the plugin market. */
    pluginLauncherOpenMarket: "pi-desktop/pluginLauncher/openMarket",
    pluginThemes: "pi-desktop/plugin/themes",
    pluginProviderCatalog: "pi-desktop/plugin/providerCatalog",
    pluginScenicThemesDestinations: "pi-desktop/plugin/scenicThemes/destinations",
    pluginScenicThemesSetBlur: "pi-desktop/plugin/scenicThemes/setBlur",
    pluginServices: "pi-desktop/plugin/services",
    pluginViews: "pi-desktop/plugin/views",
    pluginViewOpen: "pi-desktop/plugin/view/open",
    pluginViewClose: "pi-desktop/plugin/view/close",
    pluginViewSetBounds: "pi-desktop/plugin/view/setBounds",
    pluginViewSetVisible: "pi-desktop/plugin/view/setVisible",
    /**
     * The session the user is looking at, pushed by the renderer. The shell owns
     * the selection; the main process owns turn identity, so the plugin
     * `session:activated` snapshot is assembled from both (spec 07-plugins/03).
     */
    pluginSessionActive: "pi-desktop/plugin/session/active",
    /**
     * The renderer's answer to a composer suggestion offer or target probe.
     * A target probe returns an opaque renderer revision, never draft data.
     * The main process waits on this invoke to resolve the plugin's call.
     */
    pluginComposerSuggestionResult: "pi-desktop/plugin/composer/suggestionResult",
    mcpList: "pi-desktop/mcp/list",
    mcpUpsert: "pi-desktop/mcp/upsert",
    mcpRemove: "pi-desktop/mcp/remove",
    mcpSetEnabled: "pi-desktop/mcp/setEnabled",
    mcpSetScope: "pi-desktop/mcp/setScope",
    mcpTransfer: "pi-desktop/mcp/transfer",
    mcpTest: "pi-desktop/mcp/test",
    mcpOauthStart: "pi-desktop/mcp/oauth/start",
    mcpOauthCancel: "pi-desktop/mcp/oauth/cancel",
    mcpImport: "pi-desktop/mcp/import",
    mcpImportScan: "pi-desktop/mcp/importScan",
    mcpImportRun: "pi-desktop/mcp/importRun",
    mcpMarketSearch: "pi-desktop/mcp/market/search",
    skillList: "pi-desktop/skill/list",
    skillBuiltinList: "pi-desktop/skill/builtin/list",
    skillBuiltinSetEnabled: "pi-desktop/skill/builtin/setEnabled",
    skillCreate: "pi-desktop/skill/create",
    skillImport: "pi-desktop/skill/import",
    skillImportScan: "pi-desktop/skill/importScan",
    skillImportRun: "pi-desktop/skill/importRun",
    skillMarketSearch: "pi-desktop/skill/market/search",
    skillMarketFetch: "pi-desktop/skill/market/fetch",
    skillUpdate: "pi-desktop/skill/update",
    skillRemove: "pi-desktop/skill/remove",
    skillSetEnabled: "pi-desktop/skill/setEnabled",
    skillSetScope: "pi-desktop/skill/setScope",
    skillTransfer: "pi-desktop/skill/transfer",
    skillRead: "pi-desktop/skill/read",
    skillReveal: "pi-desktop/skill/reveal",
    subagentList: "pi-desktop/subagent/list",
    subagentCatalog: "pi-desktop/subagent/catalog",
    subagentCreate: "pi-desktop/subagent/create",
    subagentUpdate: "pi-desktop/subagent/update",
    subagentRead: "pi-desktop/subagent/read",
    subagentRemove: "pi-desktop/subagent/remove",
    subagentSetEnabled: "pi-desktop/subagent/setEnabled",
    subagentSetScope: "pi-desktop/subagent/setScope",
    subagentSetBuiltinEnabled: "pi-desktop/subagent/setBuiltinEnabled",
    subagentReveal: "pi-desktop/subagent/reveal",
    marketRefresh: "pi-desktop/market/refresh",
    marketSearch: "pi-desktop/market/search",
    marketBrowse: "pi-desktop/market/browse",
    marketGetDetail: "pi-desktop/market/getDetail",
    marketInstall: "pi-desktop/market/install",
    marketCheckUpdates: "pi-desktop/market/checkUpdates",
    marketApplyUpdates: "pi-desktop/market/applyUpdates",
    marketCancelInstall: "pi-desktop/market/cancelInstall",
    marketReviewSummaries: "pi-desktop/market/reviewSummaries",
    marketReviewTickers: "pi-desktop/market/reviewTickers",
    marketReviews: "pi-desktop/market/reviews",
    commandPaletteSearch: "pi-desktop/commandPalette/search",
    commandPaletteExecute: "pi-desktop/commandPalette/execute",
    logOpenFolder: "pi-desktop/log/openFolder",
    startupAnimationStatus: "pi-desktop/startupAnimation/status",
    startupAnimationOpenFolder: "pi-desktop/startupAnimation/openFolder",
    devtoolsToggle: "pi-desktop/devtools/toggle",
    composerPickFiles: "pi-desktop/composer/pickFiles",
    composerPickPhotos: "pi-desktop/composer/pickPhotos",
    composerImportFiles: "pi-desktop/composer/importFiles",
    composerPasteFiles: "pi-desktop/composer/pasteFiles",
    composerReadClipboardDirectories: "pi-desktop/composer/readClipboardDirectories",
    clipboardRecordPaste: "pi-desktop/clipboard/recordPaste",
    composerCommands: "pi-desktop/composer/commands",
    workspaceDiff: "pi-desktop/workspace/diff",
    workspaceReviewRollback: "pi-desktop/workspace/review/rollback",
    workspaceReviewTurns: "pi-desktop/workspace/review/turns",
    workspaceReviewChanges: "pi-desktop/workspace/review/changes",
    workspaceReviewContext: "pi-desktop/workspace/review/context",
    workspaceReviewOpenFile: "pi-desktop/workspace/review/openFile",
    workspaceReviewRollbackFile: "pi-desktop/workspace/review/rollbackFile",
    browserNavigate: "pi-desktop/browser/navigate",
    browserAction: "pi-desktop/browser/action",
    browserSetBounds: "pi-desktop/browser/setBounds",
    browserSetVisible: "pi-desktop/browser/setVisible",
    browserOpenExternal: "pi-desktop/browser/openExternal",
    browserGetState: "pi-desktop/browser/getState",
    browserGetPages: "pi-desktop/browser/getPages",
    fsList: "pi-desktop/fs/list",
    fsRead: "pi-desktop/fs/read",
    fsReadImageDataUrl: "pi-desktop/fs/readImageDataUrl",
    statsGetTokenUsageHistory: "pi-desktop/stats/getTokenUsageHistory",
    fsReveal: "pi-desktop/fs/reveal",
    fsOpen: "pi-desktop/fs/open",
    fsIndex: "pi-desktop/fs/index",
    fsSearch: "pi-desktop/fs/search",
    fsResolveRef: "pi-desktop/fs/resolveRef",
    windowSetWorkPanelReservation:
      "pi-desktop/window/setWorkPanelReservation",
    windowSetWorkPanelChatWidth: "pi-desktop/window/setWorkPanelChatWidth",
    windowSetBackgroundColor: "pi-desktop/window/setBackgroundColor",
    windowControl: "pi-desktop/window/control",
    closeBehaviorGet: "pi-desktop/window/closeBehavior/get",
    closeBehaviorSet: "pi-desktop/window/closeBehavior/set",
    lifecycleDialogReady: "pi-desktop/window/lifecycleDialog/ready",
    lifecycleDialogRespond: "pi-desktop/window/lifecycleDialog/respond",
    menuRendererReady: "pi-desktop/menu/rendererReady",
    workPanelTabMenu: "pi-desktop/workPanel/tabMenu",
    traySetSessionPreferences: "pi-desktop/tray/setSessionPreferences",
    nativeMenuAction: "pi-desktop/menu/nativeAction",
  },
  event: {
    lanWebUiCatalogChanged: "pi-desktop/lan-webui/catalogChanged",
    /** LAN WebUI listener, pairing or device list changed; refetch the admin view. */
    lanWebUiChanged: "pi-desktop/lan-webui/changed",
    pluginChanged: "pi-desktop/event/pluginChanged",
    /** Progress of an install or update, while it is still running. */
    pluginInstallProgress: "pi-desktop/plugin/event/installProgress",
    /** Host-originated app settings mutation (e.g. plugin `app.setTheme`). */
    settingsChanged: "pi-desktop/app/event/settingsChanged",
    configSyncChanged: "pi-desktop/configSync/event/changed",
    /** A chat-started background task started, exited, or was stopped. */
    backgroundTasksChanged: "pi-desktop/backgroundTasks/event/changed",
    /** What a running sync is doing, while it is still running. */
    configSyncProgress: "pi-desktop/configSync/event/progress",
    extensionsUiPrompt: "pi-desktop/extensions/event/uiPrompt",
    extensionsStatus: "pi-desktop/extensions/event/status",
    pluginLauncherShown: "pi-desktop/pluginLauncher/event/shown",
    agentMessage: "pi-desktop/agent/event/message",
    agentQueueChanged: "pi-desktop/agent/event/queueChanged",
    hostStatus: "pi-desktop/app/event/hostStatus",
    toast: "pi-desktop/app/event/toast",
    /**
     * The first plaintext hop to an endpoint the user typed, sent once and only
     * until the shell records `networkPolicy.insecureNoticeAcknowledged`. The
     * shell owns the wording, because the address is not a secret and the copy
     * is localized.
     */
    insecureEndpointNotice: "pi-desktop/network/event/insecureEndpointNotice",
    browserState: "pi-desktop/browser/event/state",
    browserPreview: "pi-desktop/browser/event/preview",
    browserOpenFile: "pi-desktop/browser/event/openFile",
    /**
     * A plugin asked the shell to show one of its own work-panel views
     * (`pi.ui.revealView`). The shell owns tabs, so it — not the plugin — decides
     * which session's panel takes the view.
     */
    pluginViewReveal: "pi-desktop/plugin/view/event/reveal",
    /**
     * Ask the renderer to probe an empty composer, show a suggestion group,
     * or clear what it shows. The renderer answers probes and offers over
     * `pluginComposerSuggestionResult`.
     */
    pluginComposerSuggestion: "pi-desktop/plugin/composer/event/suggestion",
    composerFileLines: "pi-desktop/composer/event/fileLines",
    windowMaximized: "pi-desktop/window/event/maximized",
    windowFullScreen: "pi-desktop/window/event/fullscreen",
    windowWorkPanelResize: "pi-desktop/window/event/workPanelResize",
    lifecycleDialogRequest: "pi-desktop/window/event/lifecycleDialogRequest",
    lifecycleDialogDismiss: "pi-desktop/window/event/lifecycleDialogDismiss",
    menuCommand: "pi-desktop/menu/event/command",
    traySessionActivated: "pi-desktop/tray/event/sessionActivated",
    notificationChanged: "pi-desktop/notification/event/changed",
    sessionsChanged: "pi-desktop/session/event/changed",
    remoteInteractions: "pi-desktop/remote/event/interactions",
    notificationActivated: "pi-desktop/notification/event/activated",
    notificationSound: "pi-desktop/notification/event/sound",
    plansChanged: "pi-desktop/plans/event/changed",
    modesChanged: "pi-desktop/modes/event/changed",
    modesCatalogChanged: "pi-desktop/modes/event/catalogChanged",
    todosChanged: "pi-desktop/todos/event/changed",
    providersOauth: "pi-desktop/providers/oauth/event",
    mcpOauth: "pi-desktop/mcp/oauth/event",
    updatesState: "pi-desktop/updates/event/state",
    voiceStateChanged: "pi-desktop/voice/event/stateChanged",
    voiceModelProgress: "pi-desktop/voice/event/modelProgress",
    liveVoiceChanged: "pi-desktop/voice/live/event/changed",
    liveVoicePort: "pi-desktop/voice/live/event/port",
    liveVoiceControl: "pi-desktop/voice/live/event/control",
    liveVoiceTranscript: "pi-desktop/voice/live/event/transcript",
    liveVoiceWidgetState: "pi-desktop/voice/live/event/widgetState",
    liveVoiceWidgetAction: "pi-desktop/voice/live/event/widgetAction",
    /** Active grant view for the indicator; `null` once the grant closes. */
    computerGrantChanged: "pi-desktop/computer/event/grantChanged",
    /** Draw commands for the click-through cursor overlay. Visualization only. */
    computerCursor: "pi-desktop/computer/event/cursor",
    /** One completed loop step, for the indicator's progress line. */
    computerStep: "pi-desktop/computer/event/step",
  },
} as const;

export const IPC_WHITELIST = new Set<string>([
  ...Object.values(IPC.invoke),
  ...Object.values(IPC.event),
]);