Files
orca/src/preload/api/cloud-workspaces-bridge.ts
T
Neil 28ae29ba2d feat(cloud): teammate profiles with a usage heatmap, and opt-in Pokes
Conductor 0.91 parity. Clicking a teammate opens their profile, which shows their role, a
26-week daily usage heatmap and their recent team workspaces. Teammates see only 0-4 levels,
and amounts are shown only to you. Pokes are opt-in in Settings > Experimental and need both
people to have them on. They are rate-limited to 1 per minute per teammate and 20 per hour, and
delivered in-app by a 30 s poll that runs only while Pokes are on and Orca is in front.

Control plane: migration 0050 (member_usage_hours, member_poke_prefs, member_pokes),
src/team-presence.ts routes. The heatmap reads usage_outbox sandbox time plus dated
token_usd_micros deltas. A member's poke opt-in is dropped when they are removed.
2026-11-10 19:24:26 -08:00

43 lines
2.5 KiB
TypeScript

import { ipcRenderer } from 'electron'
import type { PreloadApi } from '../api-types'
export const cloudWorkspacesApi = {
available: () => ipcRenderer.invoke('cloudWorkspaces:available'),
list: (query) => ipcRenderer.invoke('cloudWorkspaces:list', query),
get: (id) => ipcRenderer.invoke('cloudWorkspaces:get', { id }),
patch: (id, patch) => ipcRenderer.invoke('cloudWorkspaces:patch', { id, patch }),
resolveLink: (workspaceId, chatId) =>
ipcRenderer.invoke('cloudWorkspaces:resolveLink', { workspaceId, chatId }),
openGrant: (id) => ipcRenderer.invoke('cloudWorkspaces:openGrant', { id }),
readSnapshot: (id) => ipcRenderer.invoke('cloudWorkspaces:readSnapshot', { id }),
listGrants: (id) => ipcRenderer.invoke('cloudWorkspaces:listGrants', { id }),
revokeGrant: (id, grantId) => ipcRenderer.invoke('cloudWorkspaces:revokeGrant', { id, grantId }),
sleep: (id) => ipcRenderer.invoke('cloudWorkspaces:sleep', { id }),
destroy: (id) => ipcRenderer.invoke('cloudWorkspaces:destroy', { id }),
localWorkspaces: () => ipcRenderer.invoke('cloudWorkspaces:localWorkspaces'),
noteSent: (id) => ipcRenderer.invoke('cloudWorkspaces:noteSent', { id }),
bindEnvironment: (sandboxId, runtimeEnvironmentId, grantId) =>
ipcRenderer.invoke('cloudWorkspaces:bindEnvironment', {
sandboxId,
runtimeEnvironmentId,
grantId
}),
environmentBindings: () => ipcRenderer.invoke('cloudWorkspaces:environmentBindings'),
setActive: (args) => ipcRenderer.invoke('cloudWorkspaces:setActive', args),
getOrgPrompts: () => ipcRenderer.invoke('cloudWorkspaces:getOrgPrompts'),
putOrgPrompts: (document, revision) =>
ipcRenderer.invoke('cloudWorkspaces:putOrgPrompts', { document, revision }),
teammateProfile: (userId, utcOffsetMin) =>
ipcRenderer.invoke('cloudWorkspaces:teammateProfile', { userId, utcOffsetMin }),
poke: (userId) => ipcRenderer.invoke('cloudWorkspaces:poke', { userId }),
pokeInbox: () => ipcRenderer.invoke('cloudWorkspaces:pokeInbox'),
setPokesEnabled: (enabled) => ipcRenderer.invoke('cloudWorkspaces:setPokesEnabled', { enabled }),
markPokesSeen: (ids) => ipcRenderer.invoke('cloudWorkspaces:markPokesSeen', { ids }),
onOpenLink: (callback) => {
const listener = (_event: Electron.IpcRendererEvent, link: string): void => callback(link)
ipcRenderer.on('ui:openCloudWorkspaceLink', listener)
return () => ipcRenderer.removeListener('ui:openCloudWorkspaceLink', listener)
},
consumePendingLink: () => ipcRenderer.invoke('ui:consumePendingCloudWorkspaceLink')
} satisfies PreloadApi['cloudWorkspaces']