import { WearableConversation, WearableNativeMemory, WearableConnectorFactoryOptions, WearableSourceConnector, WearableConnectorRegistration } from '@remnic/core'; import { ConnectorApiError } from '@remnic/core/http-retry'; /** * Minimal Bee developer API client (raw fetch, no SDK). * * Contract verified against the official `@beeai/cli` source and * docs.bee.computer (2026-06). Two access modes: * * - **Proxy mode (default):** the official `bee proxy` command serves * the full developer API unauthenticated on `http://127.0.0.1:8787`. * No token required. * - **Direct mode:** `https://app-api-developer.ce.bee.amazon.dev` * with `Authorization: Bearer ` (token from `bee login`, * stored at `~/.bee/token-prod`). The direct host uses Bee's private * CA — point `NODE_EXTRA_CA_CERTS` at it when going direct. * * The legacy pre-acquisition API (`api.bee.computer`, `x-api-key`, * page/totalPages) no longer resolves and is intentionally not * supported. * * List endpoints use `limit` + `cursor` pagination with a `next_cursor` * in the envelope; timestamps are epoch milliseconds. Tokens are never * logged and never appear in thrown error messages. */ declare const BEE_DEFAULT_BASE_URL = "http://127.0.0.1:8787"; declare const BEE_DIRECT_BASE_URL = "https://app-api-developer.ce.bee.amazon.dev"; interface BeeConversationListItem { id: number; start_time: number; end_time?: number | null; device_type?: string; short_summary?: string | null; summary?: string | null; state?: string; } interface BeeUtterance { id?: number; start?: number | null; end?: number | null; spoken_at?: number; text?: string; speaker?: string; } interface BeeConversationDetail extends BeeConversationListItem { transcriptions?: Array<{ id?: number; utterances?: BeeUtterance[]; }>; primary_location?: { address?: string | null; latitude?: number; longitude?: number; } | null; } interface BeeFact { id: number; text: string; tags?: string[]; created_at?: number; confirmed?: boolean; } interface BeeConversationsPage { conversations: BeeConversationListItem[]; nextCursor: string | null; } interface BeeFactsPage { facts: BeeFact[]; nextCursor: string | null; } interface BeeClientOptions { /** Bearer token for direct mode. Omit entirely for proxy mode. */ token?: string; /** Defaults to the local `bee proxy` address. */ baseUrl?: string; fetchImpl?: typeof fetch; timeoutMs?: number; sleep?: (ms: number) => Promise; } declare class BeeApiError extends ConnectorApiError { constructor(message: string, status?: number); } declare class BeeClient { private readonly token; private readonly baseUrl; private readonly fetchImpl; private readonly timeoutMs; private readonly sleep; constructor(options?: BeeClientOptions); get usingLocalProxy(): boolean; listConversations(params?: { cursor?: string | null; limit?: number; signal?: AbortSignal; }): Promise; getConversation(id: number, signal?: AbortSignal): Promise; listFacts(params?: { cursor?: string | null; signal?: AbortSignal; }): Promise; verifyAuth(signal?: AbortSignal): Promise<{ ok: boolean; detail?: string; }>; private requestJson; } /** * True when the URL points at the local `bee proxy`. Hostname is * compared exactly after parsing — a prefix match would also treat * hosts like 127.0.0.1.evil.example as local. */ declare function isLocalProxyUrl(url: string): boolean; /** * Normalize Bee conversations into Remnic's provider-agnostic * `WearableConversation` shape. * * Bee timestamps are epoch milliseconds; utterance `speaker` values are * opaque diarization labels ("0", "1", ...) with no wearer marker — the * Remnic speaker registry is how labels become names * (`remnic wearables speakers set bee 0 "You" --self`). */ declare const BEE_SOURCE_ID = "bee"; declare function conversationToWearable(detail: BeeConversationDetail): WearableConversation; declare function factToNativeMemory(fact: BeeFact): WearableNativeMemory; /** * @remnic/connector-bee — Bee wearable connector. * * À-la-carte optional companion of @remnic/core (computed-specifier * discovery; importing this module self-registers idempotently). * * Access modes: * - default: the local `bee proxy` (http://127.0.0.1:8787, no token) * - direct: set `wearables.sources.bee.baseUrl` to the direct host * and provide a token via `REMNIC_BEE_API_TOKEN` / * `BEE_API_TOKEN` (or `apiKey` in config) * * Bee's list API has no date filter, so the connector paginates * newest-first and filters conversations to the requested local day, * stopping once a whole page predates it. */ declare function resolveBeeToken(configuredToken: string | undefined, env?: NodeJS.ProcessEnv): string | undefined; declare function createBeeConnector(options: WearableConnectorFactoryOptions): WearableSourceConnector; declare const wearableConnectorRegistration: WearableConnectorRegistration; /** * Idempotently register the connector with the core registry. Importing * this module registers it as a side effect; calling this again is safe * (returns false when already registered). */ declare const ensureBeeConnectorRegistered: () => boolean; export { BEE_DEFAULT_BASE_URL, BEE_DIRECT_BASE_URL, BEE_SOURCE_ID, BeeApiError, BeeClient, type BeeClientOptions, type BeeConversationDetail, type BeeConversationListItem, type BeeConversationsPage, type BeeFact, type BeeFactsPage, type BeeUtterance, conversationToWearable, createBeeConnector, ensureBeeConnectorRegistered, factToNativeMemory, isLocalProxyUrl, resolveBeeToken, wearableConnectorRegistration };