docs(snapshot): tag profile-level vs company-scoped fields

Adds an inline comment partition and typed PROFILE_LEVEL_KEYS /
COMPANY_SCOPED_KEYS constants on ProfileSnapshot so callers can
reason about which fields survive a company switch. Shape is
unchanged; renderer consumption is unaffected.
This commit is contained in:
ZacharyZhang-NY committed 2026-04-16 23:28:04 -04:00
1 parent 24ea9cff69
commit 0f881097bc
1 file changed
+40
+40
View File
@@ -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<keyof ProfileSnapshot>;
/** 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<keyof ProfileSnapshot>;
export type ProfileLevelKey = typeof PROFILE_LEVEL_KEYS[number];
export type CompanyScopedKey = typeof COMPANY_SCOPED_KEYS[number];