import { type InstanceFeatureKey } from "./feature-catalog.js"; /** * Operator-configurable settings visibility. * * A hosting operator (a managed cloud, an internal shared server) can hide * settings surfaces that do not apply to their deployment by setting the * `PAPERCLIP_HIDDEN_SETTINGS` environment variable to a comma-separated * list of keys from this registry. An experimental wildcard with named * exceptions can also hide future controls automatically. Hiding a surface removes it from the UI * (nav, routes, page sections). Surfaces backed by instance-level mutation * routes are also floored with a 403 carrying * `SETTINGS_OPERATOR_MANAGED_ERROR_CODE`: the Access, Plugins, and Adapters * pages, every field-backed General section, every experimental toggle * (individually or via the whole Experimental page), and the company Import * page (whose whole route surface is floored). The other company pages are * UI-visibility keys only: their APIs (memberships, invites, secrets, * exports) stay live for agents and integrations. * * Nothing is hidden by default: with the variable unset, UI and API behave * exactly as before this mechanism existed. * * Unknown keys are ignored (with a server-side warning) rather than rejected, * so an operator may roll one list across a fleet of mixed app versions: an * image that predates a key simply keeps that surface visible instead of * refusing to boot. */ /** * Instance settings pages that can be hidden (nav entry + route). The General * page is deliberately not hideable: it is the settings root and the redirect * target for hidden pages. Individual General sections are hideable below. */ export declare const HIDEABLE_INSTANCE_PAGES: readonly ["instance.profile", "instance.environments", "instance.access", "instance.experimental", "instance.plugins", "instance.adapters"]; export type HideableInstancePage = (typeof HIDEABLE_INSTANCE_PAGES)[number]; /** * Company-level settings pages that can be hidden (nav entry + tab + route). * The company General page is deliberately not hideable: it is the settings * root and the redirect target for hidden pages. `company.import` also floors * the import API routes; the rest only hide UI surfaces. */ export declare const HIDEABLE_COMPANY_PAGES: readonly ["company.members", "company.invites", "company.secrets", "company.export", "company.import"]; export type HideableCompanyPage = (typeof HIDEABLE_COMPANY_PAGES)[number]; /** * Sub-surfaces of company settings pages that can be hidden individually. * UI-visibility keys only: the backing APIs stay live for agents and * integrations. Hiding the whole page (`company.secrets`) already removes * everything inside it; these keys hide one tab while the page stays up. */ export declare const HIDEABLE_COMPANY_SECTIONS: readonly ["company.secrets.vaults", "company.secrets.proposals"]; export type HideableCompanySection = (typeof HIDEABLE_COMPANY_SECTIONS)[number]; /** * Sections of Instance → General that can be hidden. Field-backed sections * (their suffix names a general-settings field) also floor writes to that * field; `deploymentStatus` and `signOut` are read-only UI with no field. */ export declare const HIDEABLE_GENERAL_SECTIONS: readonly ["instance.general.deploymentStatus", "instance.general.censorUsernameInLogs", "instance.general.backupRetention", "instance.general.feedbackDataSharingPreference", "instance.general.signOut"]; export type HideableGeneralSection = (typeof HIDEABLE_GENERAL_SECTIONS)[number]; /** General sections that are informational UI only, with no settings field. */ export declare const UI_ONLY_GENERAL_SECTIONS: readonly ["instance.general.deploymentStatus", "instance.general.signOut"]; export type HideableExperimentalSetting = `instance.experimental.${InstanceFeatureKey}`; /** The visibility key for an experimental toggle; every boolean flag is hideable. */ export declare function experimentalSettingKey(key: InstanceFeatureKey): HideableExperimentalSetting; /** Workspace policy editors and selectors. UI-only; execution and APIs stay active. */ export declare const HIDEABLE_WORKSPACE_SECTIONS: readonly ["workspaces.isolation"]; export type HideableWorkspaceSection = (typeof HIDEABLE_WORKSPACE_SECTIONS)[number]; export type HideableSettingKey = HideableWorkspaceSection | HideableInstancePage | HideableCompanyPage | HideableCompanySection | HideableGeneralSection | HideableExperimentalSetting; /** Concrete setting keys; the parser also accepts the experimental wildcard and exceptions. */ export declare const HIDEABLE_SETTING_KEYS: readonly HideableSettingKey[]; /** Stable 403 code for writes to operator-hidden settings. */ export declare const SETTINGS_OPERATOR_MANAGED_ERROR_CODE = "settings_operator_managed"; /** Hide current and future experimental controls, with optional !key exceptions. */ export declare const EXPERIMENTAL_SETTINGS_WILDCARD = "instance.experimental.*"; export interface ParsedHiddenSettings { /** Concrete keys, deduplicated; wildcard-derived keys follow in catalog order. */ hidden: HideableSettingKey[]; /** Unrecognized entries, for the caller to warn about. */ unknown: string[]; } /** * Parse operator settings into concrete keys for both the UI and API. * `instance.experimental.*` hides every catalog control except entries such as * `!instance.experimental.enableEnvironments`. Exceptions only affect the * wildcard; an explicit hidden key or hidden parent page always wins. */ export declare function parseHiddenSettingsList(raw: string | undefined): ParsedHiddenSettings; export declare function hidesInstancePage(hidden: ReadonlySet, page: HideableInstancePage): boolean; export declare function hidesCompanyPage(hidden: ReadonlySet, page: HideableCompanyPage): boolean; export declare function hidesCompanySection(hidden: ReadonlySet, section: HideableCompanySection): boolean; export declare function hidesGeneralSection(hidden: ReadonlySet, section: HideableGeneralSection): boolean; /** * Whether a toggle is hidden, either individually or because the whole * Experimental page is hidden. */ export declare function hidesExperimentalSetting(hidden: ReadonlySet, key: InstanceFeatureKey): boolean; //# sourceMappingURL=settings-visibility.d.ts.map