/** * VibeControls AI assistant modes. * * ★ These are the modes the shared fe-libs panel OFFERS. The first switch into a * `writeCapable` mode opens the one-time consent dialog, enforced in fe-libs * (`shared/assistant/ui/AssistantChatArea`); what is decided HERE is which modes * carry that flag. Same mechanism as HealthyBowl's `assistantUsecases.ts`. * * ★★★ NO MODE IS ADMIN-GATED (BOFF-7800). Every mode is offered to every * member, and RBAC alone decides what any of them may actually do. The decision: * "Allow anyone to use any mode keeping auto as default — but RBAC will control * everything behind the scenes. If they can't do something, RBAC won't allow." * * ★★ The gate this replaces was asking the wrong question at the wrong scope. * It read the caller's role at the ACTIVE ORG (`myRoles` via * `getOrganizationId()`), while product writes are governed by the WORKSPACE * scope — so a workspace Editor, whom the server already permits, was refused * by the UI for being an org Viewer. Verified server-side: `sandbox:create` is * granted to Editor and above (wspace-rbac-svc seed-unified-rbac.ts:5836-5842), * so this exposes what the server already allows rather than granting anything. * A workspace Viewer is still refused — by RBAC, where the refusal belongs, and * it now reads as a permission answer rather than a malfunction (fe-libs #259). * * assistant "Ask". Every member. The sandbox runs with * AI_ASSISTANT_READONLY, so its GraphQL helper refuses mutations. * api-calls "Take action". Admins only. Writes through the gateway, and * the sandbox runs with AI_ASSISTANT_CONFIRM_WRITES, so each * write waits for the user's approval. * vibe-plugins "Build". Admins only. Builds plugin artifacts, but its sandbox * is NOT read-only; see the note on BUILD below. Not flagged * `writeCapable` (yet), for the reason given there. * * ★★ `general` is gone. A stored `general`, or any mode not listed here, lands * on Ask; see `resolveOfferedMode` and `useOfferedAssistantMode`. * * ★ The mode IDs are transport values and must not be renamed: they choose the * sandbox image, its environment and the agent's persona. Only labels change. */ export interface AssistantUsecase { id: string; label: string; description: string; suggestions: readonly string[]; /** * ★★★ DELIBERATELY UNSET ON EVERY MODE (BOFF-7800). The field remains because * fe-libs still reads it, and declaring it is what switches the org-role check * back on — `useAssistantApiAccess` derives `hasAdminGatedMode` from exactly * this flag, so one `requiresAdmin: true` here silently restores the gate and * fires a `myRoles` query on every session. A test asserts no mode sets it. */ requiresAdmin?: boolean; /** Can change live data, so the consent dialog and the composer's write-access warning apply. */ writeCapable?: boolean; } export declare const ASSISTANT_USECASE_CONFIG: readonly [{ readonly id: "assistant"; readonly label: "Ask"; readonly description: "Ask about VibeControls and your workspace. It reads your vibes, sessions and agents, explains what you are looking at and points you to the right page. Read-only."; readonly suggestions: readonly ["What can I do on this screen?", "List my recent sessions", "Where do I manage my agents?", "How do tunnels work?"]; }, { readonly id: "api-calls"; readonly label: "Take action"; readonly description: "Let the assistant make changes for you: create vibes, rename them, stop sessions. It shows you each change and waits for your approval before anything is saved."; readonly suggestions: readonly ["Create a new vibe called demo", "Rename one of my vibes", "Stop a session I no longer need", "List my recent sessions"]; readonly writeCapable: true; }, { readonly id: "vibe-plugins"; readonly label: "Build"; readonly description: "Build a Vibe Plugin that extends VibeControls. The assistant scaffolds and compiles it from the platform guides and gives you the files to download."; readonly suggestions: readonly ["How do I create a new Vibe Plugin?", "What is the plugin manifest structure?", "Explain the plugin lifecycle hooks", "Show me a plugin example with frontend UI"]; }]; export type AssistantUsecaseId = (typeof ASSISTANT_USECASE_CONFIG)[number]['id']; /** * Where a user lands when their mode is not offered. * * ★ The same literal fe-libs falls back to (`AssistantChatArea` resets to * `"assistant"` once the role check settles). Typed as a mode ID, so removing * Ask from the list above fails the typecheck here. */ export declare const DEFAULT_ASSISTANT_MODE: AssistantUsecaseId; /** * The mode to use for a stored one: itself when this product offers it, Ask * when it does not (a retired `general`, another product's mode, a corrupt * value). * * ★ It answers only "does this mode EXIST here". Whether the user may use an * admin-only mode is the role check's question and stays with fe-libs: resetting * an admin's stored Take action here, before `myRoles` answers, would throw them * out of that mode on every reload. */ export declare function resolveOfferedMode(mode: unknown): AssistantUsecaseId;