import { type ResolvedEnvironment } from "@sapiom/mcp/auth"; import { refreshStudioCredentials } from "./studio-credentials.js"; import type { OpenCodeTransportErrorCode } from "../shared/opencode-errors.js"; export type AssistantAccessFailureCode = Extract; /** * Who the Assistant runs as. The bridge forwards with this environment's API * key, which already authorizes every model call it makes; this record only * decides whether Studio shows the Assistant. */ export interface AssistantGrant { userId: string; tenantId: string; environment: ResolvedEnvironment; } /** Browser-safe access state. The revision changes only with the account. */ export interface AssistantAccessProjection { enabled: boolean; authorityRevision: string; } export interface AssistantAccessOptions { enabled: boolean; harnessVersion: string; getApiKey: () => string | null; environment?: string; loadEnvironment?: () => Promise; refreshCredentials?: typeof refreshStudioCredentials; fetch?: typeof globalThis.fetch; /** How often the PostHog kill switch is re-read. */ refreshIntervalMs?: number; } /** Same account and key: running Assistant hosts may keep going. */ export declare const samePrincipal: (a: AssistantGrant, b: AssistantGrant) => boolean; /** * Whether the signed-in Studio account has the Assistant: asked of * `/v1/studio/capabilities` at boot, on every credential change, and every * five minutes so turning the flag off takes effect without a restart. A * network or 5xx failure keeps the last answer. */ export declare class AssistantAccess { private readonly options; private grant; private failure; private authorityRevision; private generation; private closed; private refreshTimer?; private listeners; constructor(options: AssistantAccessOptions); get(): AssistantGrant | null; getFailureCode(): AssistantAccessFailureCode; getBrowserState(): AssistantAccessProjection; subscribe(listener: () => void): () => void; clear(): void; refresh(): Promise; close(): void; private adopt; private check; } //# sourceMappingURL=assistant-access.d.ts.map