diff --git a/src/shared/types/snapshot.ts b/src/shared/types/snapshot.ts index 4578d204..f401b979 100644 --- a/src/shared/types/snapshot.ts +++ b/src/shared/types/snapshot.ts @@ -25,6 +25,7 @@ import type { } from "./records-extended"; export interface ProfileSnapshot { + // ─── Profile-level (shared across all companies) ───────────────────────── currentCompanyId: string | null; profilePath: string; updatesEnabled: boolean; @@ -35,6 +36,7 @@ export interface ProfileSnapshot { }; companies: CompanyRecord[]; connectors: ConnectorRecord[]; + // ─── Company-scoped collections (current company only) ─────────────────── workspaces: WorkspaceRecord[]; agents: AgentRecord[]; goals: GoalRecord[]; @@ -56,3 +58,41 @@ export interface ProfileSnapshot { workflows: WorkflowPipelineRecord[]; } +/** Fields that are shared across companies and loaded regardless of currentCompanyId. */ +export const PROFILE_LEVEL_KEYS = [ + "currentCompanyId", + "profilePath", + "updatesEnabled", + "theme", + "locale", + "backend", + "companies", + "connectors", +] as const satisfies ReadonlyArray; + +/** Fields that are filtered to the current company; switching companies reloads these. */ +export const COMPANY_SCOPED_KEYS = [ + "workspaces", + "agents", + "goals", + "projects", + "tasks", + "approvals", + "runs", + "costs", + "activity", + "secrets", + "comments", + "socialAccounts", + "meetings", + "documents", + "knowledgeBase", + "sprints", + "automationRules", + "agentMessages", + "workflows", +] as const satisfies ReadonlyArray; + +export type ProfileLevelKey = typeof PROFILE_LEVEL_KEYS[number]; +export type CompanyScopedKey = typeof COMPANY_SCOPED_KEYS[number]; +