export declare const LOBU_CONFIG_DIR: string; export declare const DEFAULT_CONTEXT_NAME = "lobu"; export declare const DEFAULT_LOBU_MCP_URL = "https://lobu.ai/mcp"; /** * Org slugs are lowercase alphanumerics plus `-`/`_`, no leading/trailing * separator. Single source of truth for both the API client's slug guard and * `setActiveOrg` validation. */ export declare const ORG_SLUG_PATTERN: RegExp; /** * Validate an org slug against {@link ORG_SLUG_PATTERN}, throwing `Error` with a * consistent message when it doesn't match. Callers that need a typed error * (e.g. `ApiClientError`) catch and rewrap. */ export declare function validateOrgSlug(slug: string): string; export interface LobuServerConfig { port?: number; host?: string; cwd?: string; lifecycle?: "managed" | "external"; } interface LobuContextEntry { url: string; activeOrg?: string; memoryUrl?: string; lifecycle?: "managed" | "external"; cwd?: string; } interface LobuContextConfig { currentContext: string; contexts: Record; } export interface ResolvedContext { name: string; url: string; source: "default" | "config" | "env"; } export declare function loadContextConfig(): Promise; export declare function getCurrentContextName(): Promise; export declare function getActiveOrg(contextName?: string): Promise; export declare function getMemoryUrl(contextName?: string): Promise; export declare function setActiveOrg(orgSlug: string, contextName?: string): Promise; export declare function setMemoryUrl(memoryUrl: string, contextName?: string): Promise; export declare function resolveContext(preferredContext?: string): Promise; export declare function addContext(name: string, url: string, server?: LobuServerConfig): Promise; export declare function removeContext(name: string): Promise; export declare function setCurrentContext(name: string): Promise; export declare function getServerConfig(contextName?: string): Promise; /** * Reduce a context's API URL to the gateway ORIGIN the worker API is mounted on. * * Context URLs carry the SDK path (`https://app.lobu.ai/api/v1`) but * `/api/workers/*` is mounted at the app root, so passing the context URL * straight through builds `/api/v1/api/workers/poll` and every device call * 404s. Only production contexts carry that path — a local context is a bare * `http://localhost:` — which is why the mismatch is invisible in dev. * The Owletto Mac app already reduces the same way before polling * (`LobuContextIdentity.origin(of:)`). */ export declare function apiUrlToGatewayOrigin(url: string): string; export declare function findContextByUrl(apiUrl: string): Promise; /** * Find the named context whose API URL belongs to the same gateway origin. * * Device endpoints live at the origin while a hosted context carries the * `/api/v1` SDK suffix — the built-in `lobu` context included. Matching those * two spellings is safe because an OAuth bearer never crosses the URL origin * boundary. The current context wins ties; otherwise user-named contexts win * over the always-present built-in context, because that is normally where the * installation login is stored. */ export declare function findContextByOrigin(apiUrl: string): Promise; export declare function findContextByMemoryUrl(memoryUrl: string): Promise; export {}; //# sourceMappingURL=context.d.ts.map