@@ -91,6 +91,44 @@ export const POSTHOG_DEV_CLIENT_ID = 'DC5uRLVbGI02YQ82grxgnK6Qn12SXWpCqdPb60oZ';
9191export const POSTHOG_PROXY_CLIENT_ID = POSTHOG_US_CLIENT_ID ;
9292export const DUMMY_PROJECT_API_KEY = '_YOUR_POSTHOG_PROJECT_TOKEN_' ;
9393
94+ /**
95+ * Scopes the wizard requests during the agentic provisioning signup flow.
96+ *
97+ * Each entry is justified by what the wizard's agent step does after signup:
98+ * - user:read identify the user for analytics + agent context
99+ * - project:read look up the freshly-provisioned project
100+ * - llm_gateway:read authenticate to gateway.{us,eu}.posthog.com/wizard
101+ * (the agent's LLM calls — without this scope, every
102+ * agent message returns 401)
103+ * - query:read run HogQL queries when the agent needs data
104+ * - dashboard:write create the onboarding dashboard during setup
105+ * - insight:write create the onboarding insights during setup
106+ *
107+ * Must be a subset of `ALLOWED_PROVISIONING_SCOPES` in
108+ * `ee/api/agentic_provisioning/views.py` on the backend.
109+ */
110+ export const WIZARD_PROVISIONING_SCOPES = [
111+ 'user:read' ,
112+ 'project:read' ,
113+ 'llm_gateway:read' ,
114+ 'dashboard:write' ,
115+ 'insight:write' ,
116+ 'query:read' ,
117+ ] as const ;
118+
119+ /**
120+ * Scopes the wizard requests during the OAuth login flow. Superset of
121+ * `WIZARD_PROVISIONING_SCOPES` with two scopes that only apply to the login
122+ * path and are not in the provisioning allowlist:
123+ * - introspection lets the wizard introspect its own token
124+ * - health_issue:read used by `wizard doctor`
125+ */
126+ export const WIZARD_OAUTH_SCOPES = [
127+ ...WIZARD_PROVISIONING_SCOPES ,
128+ 'introspection' ,
129+ 'health_issue:read' ,
130+ ] as const ;
131+
94132// ── Wizard run / variants ───────────────────────────────────────────
95133
96134export const WIZARD_INTERACTION_EVENT_NAME = 'wizard interaction' ;
0 commit comments