@nebula-ai/sdk 1.4.0 → 1.6.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -13
- package/dist/index.cjs +75 -198
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +112 -353
- package/dist/index.d.ts +112 -353
- package/dist/index.js +75 -198
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["unwrap"],"sources":["../src/runtime/errors.ts","../src/runtime/retry.ts","../src/runtime/client.ts","../src/resources/client.ts","../src/resources/collections.ts","../src/resources/connectors.ts","../src/resources/memories.ts","../src/resources/snapshots.ts","../src/client.ts","../src/lib/_dx_generated.ts","../src/lib/dx.ts"],"sourcesContent":["export class NebulaError extends Error {\n override readonly name: string = \"NebulaError\";\n constructor(message: string, options?: { cause?: unknown }) {\n super(message, options);\n }\n}\n\nexport class NebulaConnectionError extends NebulaError {\n override readonly name = \"NebulaConnectionError\";\n}\n\nexport class NebulaTimeoutError extends NebulaError {\n override readonly name = \"NebulaTimeoutError\";\n}\n\n// Canonical Error envelope returned by every Nebula 4xx/5xx. The runtime\n// pulls these fields out of the response body and surfaces them as typed\n// accessors on NebulaAPIError so callers can branch on err.code without\n// digging into err.body.\n//\n// The optional fields are typed as `T | null` because the wire schema is\n// `anyOf [T, null]` — the server emits the keys with explicit `null` rather\n// than omitting them. The NebulaAPIError constructor coerces `null` to\n// `undefined` so the public accessor surface stays `T | undefined`.\nexport interface ErrorEnvelope {\n readonly type: string;\n readonly message: string;\n readonly code?: string | null;\n readonly request_id?: string | null;\n // `details` is intentionally `unknown`: the server emits arbitrary\n // JSON here. For validation errors it's an array of {loc, msg, type}\n // entries; for other classes it can be an object or null. Callers\n // should narrow at the read site (e.g. `Array.isArray(err.details)`).\n readonly details?: unknown;\n}\n\nexport interface APIErrorPayload {\n readonly status: number;\n readonly requestId?: string;\n readonly body: unknown;\n}\n\nfunction isEnvelope(body: unknown): body is ErrorEnvelope {\n return (\n typeof body === \"object\" &&\n body !== null &&\n typeof (body as { type?: unknown }).type === \"string\" &&\n typeof (body as { message?: unknown }).message === \"string\"\n );\n}\n\nexport class NebulaAPIError extends NebulaError {\n override readonly name: string = \"NebulaAPIError\";\n readonly status: number;\n readonly requestId?: string;\n readonly body: unknown;\n // Canonical envelope fields. `type` is always present when the server\n // returned the documented envelope; the rest are present when the server\n // populated them. All four are undefined when the response body wasn't\n // an envelope (e.g. an HTML error page from a misconfigured proxy).\n readonly type?: string;\n readonly code?: string;\n readonly details?: unknown;\n\n constructor(payload: APIErrorPayload, message?: string) {\n const envelope = isEnvelope(payload.body) ? payload.body : undefined;\n super(\n message ??\n envelope?.message ??\n `Nebula API error (status ${payload.status})`\n );\n this.status = payload.status;\n // Coerce `null` (wire-level) to `undefined` (idiomatic JS absence) so\n // every accessor's runtime value matches its declared T | undefined.\n const envCode =\n typeof envelope?.code === \"string\" ? envelope.code : undefined;\n const envRid =\n typeof envelope?.request_id === \"string\"\n ? envelope.request_id\n : undefined;\n // Prefer the envelope's request_id (server-stamped) over the header\n // we captured at the transport — they should match, but if they\n // diverge the envelope is authoritative.\n this.requestId = envRid ?? payload.requestId;\n this.body = payload.body;\n this.type = envelope?.type;\n this.code = envCode;\n this.details = envelope?.details ?? undefined;\n }\n}\n\nexport class NebulaBadRequestError extends NebulaAPIError {\n override readonly name = \"NebulaBadRequestError\";\n}\nexport class NebulaUnauthorizedError extends NebulaAPIError {\n override readonly name = \"NebulaUnauthorizedError\";\n}\nexport class NebulaForbiddenError extends NebulaAPIError {\n override readonly name = \"NebulaForbiddenError\";\n}\nexport class NebulaNotFoundError extends NebulaAPIError {\n override readonly name = \"NebulaNotFoundError\";\n}\nexport class NebulaConflictError extends NebulaAPIError {\n override readonly name = \"NebulaConflictError\";\n}\nexport class NebulaValidationError extends NebulaAPIError {\n override readonly name = \"NebulaValidationError\";\n}\nexport class NebulaRateLimitError extends NebulaAPIError {\n override readonly name = \"NebulaRateLimitError\";\n readonly retryAfter?: number;\n constructor(payload: APIErrorPayload, retryAfter?: number) {\n super(payload);\n this.retryAfter = retryAfter;\n }\n}\nexport class NebulaServerError extends NebulaAPIError {\n override readonly name = \"NebulaServerError\";\n}\n\ntype APIErrorCtor = new (payload: APIErrorPayload) => NebulaAPIError;\n\nconst STATUS_TO_CLASS: Record<number, APIErrorCtor> = {\n 400: NebulaBadRequestError,\n 401: NebulaUnauthorizedError,\n 403: NebulaForbiddenError,\n 404: NebulaNotFoundError,\n 409: NebulaConflictError,\n 422: NebulaValidationError,\n};\n\nexport function errorFromResponse(payload: APIErrorPayload, retryAfter?: number): NebulaAPIError {\n if (payload.status === 429) return new NebulaRateLimitError(payload, retryAfter);\n const cls = STATUS_TO_CLASS[payload.status];\n if (cls) return new cls(payload);\n if (payload.status >= 500) return new NebulaServerError(payload);\n return new NebulaAPIError(payload);\n}\n","export interface RetryPolicy {\n readonly maxRetries: number;\n readonly baseMs: number;\n readonly maxMs: number;\n}\n\nexport const DEFAULT_RETRY: RetryPolicy = {\n maxRetries: 2,\n baseMs: 250,\n maxMs: 8000,\n};\n\nconst RETRYABLE_STATUSES: ReadonlySet<number> = new Set([408, 429, 502, 503, 504]);\n\nexport function isRetryableStatus(status: number): boolean {\n return RETRYABLE_STATUSES.has(status);\n}\n\nexport function backoffMs(attempt: number, policy: RetryPolicy, retryAfterSec?: number): number {\n if (retryAfterSec != null && Number.isFinite(retryAfterSec)) {\n return Math.min(retryAfterSec * 1000, policy.maxMs);\n }\n const exp = Math.min(policy.baseMs * 2 ** attempt, policy.maxMs);\n return Math.floor(Math.random() * exp);\n}\n\nexport function sleep(ms: number, signal?: AbortSignal): Promise<void> {\n if (ms <= 0) return Promise.resolve();\n return new Promise((resolveSleep, reject) => {\n const handle = setTimeout(resolveSleep, ms);\n if (signal) {\n const onAbort = () => {\n clearTimeout(handle);\n reject(signal.reason ?? new Error(\"aborted\"));\n };\n if (signal.aborted) onAbort();\n else signal.addEventListener(\"abort\", onAbort, { once: true });\n }\n });\n}\n","import {\n errorFromResponse,\n NebulaAPIError,\n NebulaConnectionError,\n NebulaTimeoutError,\n} from \"./errors.ts\";\nimport { backoffMs, DEFAULT_RETRY, isRetryableStatus, sleep, type RetryPolicy } from \"./retry.ts\";\n\nexport interface ClientOptions {\n baseUrl?: string;\n apiKey?: string;\n bearerToken?: string;\n defaultHeaders?: Record<string, string>;\n fetchImpl?: typeof fetch;\n // Caller-supplied RequestInit fields applied to every outbound fetch.\n // Lets browser callers pass `credentials: \"include\"` for cookie auth,\n // or `mode`/`cache`/`referrer` for cross-origin tuning. Method, headers,\n // body, and signal are owned by the runtime and cannot be overridden\n // here (they're set per-request).\n fetchOptions?: Omit<RequestInit, \"method\" | \"headers\" | \"body\" | \"signal\">;\n timeoutMs?: number;\n retry?: Partial<RetryPolicy>;\n userAgent?: string;\n}\n\nexport interface RequestArgs {\n method: \"GET\" | \"POST\" | \"PUT\" | \"PATCH\" | \"DELETE\";\n path: string;\n pathParams?: Record<string, string | number>;\n query?: Record<string, unknown>;\n body?: unknown;\n headers?: Record<string, string>;\n idempotent?: boolean;\n signal?: AbortSignal;\n}\n\nconst DEFAULT_BASE_URL = \"https://api.zeroset.com\";\nconst DEFAULT_TIMEOUT_MS = 60_000;\n\nexport class NebulaCore {\n readonly baseUrl: string;\n readonly apiKey?: string;\n readonly bearerToken?: string;\n readonly defaultHeaders: Record<string, string>;\n readonly fetchImpl: typeof fetch;\n readonly fetchOptions: Omit<RequestInit, \"method\" | \"headers\" | \"body\" | \"signal\">;\n readonly timeoutMs: number;\n readonly retry: RetryPolicy;\n readonly userAgent: string;\n\n constructor(options: ClientOptions = {}) {\n this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/$/, \"\");\n this.apiKey = options.apiKey;\n this.bearerToken = options.bearerToken;\n // Filter null/undefined values. Callers (often using `as any` to\n // bypass the `Record<string, string>` type) pass nulls to suppress\n // a header — but `new Headers({k: null})` coerces null to the\n // literal string \"null\", which a backend that checks \"is this\n // header present\" treats as an explicit credential. Strip nulls\n // here so the Headers constructor sees only real string values.\n this.defaultHeaders = filterNullishHeaders(options.defaultHeaders);\n this.fetchImpl = options.fetchImpl ?? globalThis.fetch.bind(globalThis);\n this.fetchOptions = options.fetchOptions ?? {};\n this.timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;\n this.retry = { ...DEFAULT_RETRY, ...(options.retry ?? {}) };\n this.userAgent = options.userAgent ?? \"nebula-sdk-js/0.0.1\";\n }\n\n buildUrl(path: string, pathParams?: Record<string, string | number>, query?: Record<string, unknown>): string {\n let resolved = path;\n if (pathParams) {\n for (const [k, v] of Object.entries(pathParams)) {\n resolved = resolved.replace(`{${k}}`, encodeURIComponent(String(v)));\n }\n }\n const url = new URL(this.baseUrl + resolved);\n if (query) {\n for (const [k, v] of Object.entries(query)) {\n if (v === undefined || v === null) continue;\n if (Array.isArray(v)) for (const item of v) url.searchParams.append(k, String(item));\n else url.searchParams.set(k, String(v));\n }\n }\n return url.toString();\n }\n\n private buildHeaders(perRequest?: Record<string, string>, hasBody = false): Headers {\n const headers = new Headers(this.defaultHeaders);\n headers.set(\"User-Agent\", this.userAgent);\n headers.set(\"Accept\", \"application/json\");\n if (hasBody) headers.set(\"Content-Type\", \"application/json\");\n if (this.apiKey) headers.set(\"X-API-Key\", this.apiKey);\n if (this.bearerToken) headers.set(\"Authorization\", `Bearer ${this.bearerToken}`);\n if (perRequest) {\n for (const [k, v] of Object.entries(perRequest)) headers.set(k, v);\n }\n return headers;\n }\n\n async request<T>(args: RequestArgs): Promise<T> {\n const url = this.buildUrl(args.path, args.pathParams, args.query);\n const hasBody = args.body !== undefined && args.body !== null;\n const headers = this.buildHeaders(args.headers, hasBody);\n // Spread caller-supplied fetch options first so the runtime-owned\n // method/headers/body always win on key collision. The TS type for\n // `fetchOptions` already excludes those keys, so this is belt-and-\n // suspenders.\n const init: RequestInit = {\n ...this.fetchOptions,\n method: args.method,\n headers,\n body: hasBody ? JSON.stringify(args.body) : undefined,\n };\n\n const maxAttempts = (args.idempotent ?? false) ? this.retry.maxRetries + 1 : 1;\n let lastError: unknown;\n for (let attempt = 0; attempt < maxAttempts; attempt++) {\n const controller = new AbortController();\n const timeoutHandle = setTimeout(() => controller.abort(new Error(\"timeout\")), this.timeoutMs);\n const { signal: composedSignal, dispose: disposeAbort } = composeAbort(\n controller.signal,\n args.signal\n );\n try {\n const response = await this.fetchImpl(url, { ...init, signal: composedSignal });\n\n if (response.ok) {\n if (response.status === 204) return undefined as T;\n return (await response.json()) as T;\n }\n\n const text = await safeReadText(response);\n const parsed = safeParseJSON(text);\n const retryAfter = parseRetryAfter(response.headers.get(\"Retry-After\"));\n const err = errorFromResponse(\n {\n status: response.status,\n requestId: response.headers.get(\"X-Request-Id\") ?? undefined,\n body: parsed ?? text,\n },\n retryAfter\n );\n\n if (isRetryableStatus(response.status) && attempt + 1 < maxAttempts) {\n await sleep(backoffMs(attempt, this.retry, retryAfter), args.signal);\n lastError = err;\n continue;\n }\n throw err;\n } catch (rawError) {\n if (rawError instanceof Error && rawError.name === \"AbortError\") {\n if (args.signal?.aborted) throw rawError;\n throw new NebulaTimeoutError(`Request timed out after ${this.timeoutMs}ms`, { cause: rawError });\n }\n if (rawError instanceof NebulaAPIError || rawError instanceof NebulaConnectionError) {\n throw rawError;\n }\n if (attempt + 1 < maxAttempts) {\n await sleep(backoffMs(attempt, this.retry), args.signal);\n lastError = rawError;\n continue;\n }\n if (rawError instanceof Error) {\n throw new NebulaConnectionError(rawError.message, { cause: rawError });\n }\n throw rawError;\n } finally {\n clearTimeout(timeoutHandle);\n disposeAbort();\n }\n }\n throw lastError ?? new NebulaConnectionError(\"retry budget exhausted\");\n }\n}\n\nfunction composeAbort(\n timeoutSignal: AbortSignal,\n userSignal?: AbortSignal\n): { signal: AbortSignal; dispose: () => void } {\n if (!userSignal) return { signal: timeoutSignal, dispose: () => {} };\n const controller = new AbortController();\n // Hold one listener per source so dispose can detach exactly what we added.\n // Caller's signal can outlive the request (e.g. a long-lived request-scope\n // controller reused across many SDK calls); without dispose, each call's\n // closures would stay pinned on it until that signal eventually aborts.\n const onTimeoutAbort = () =>\n controller.abort(timeoutSignal.reason ?? new Error(\"aborted\"));\n const onUserAbort = () =>\n controller.abort(userSignal.reason ?? new Error(\"aborted\"));\n if (timeoutSignal.aborted) controller.abort(timeoutSignal.reason);\n if (userSignal.aborted) controller.abort(userSignal.reason);\n timeoutSignal.addEventListener(\"abort\", onTimeoutAbort, { once: true });\n userSignal.addEventListener(\"abort\", onUserAbort, { once: true });\n const dispose = () => {\n timeoutSignal.removeEventListener(\"abort\", onTimeoutAbort);\n userSignal.removeEventListener(\"abort\", onUserAbort);\n };\n return { signal: controller.signal, dispose };\n}\n\nasync function safeReadText(response: Response): Promise<string> {\n try {\n return await response.text();\n } catch {\n return \"\";\n }\n}\n\nfunction safeParseJSON(text: string): unknown {\n if (!text) return undefined;\n try {\n return JSON.parse(text);\n } catch {\n return undefined;\n }\n}\n\nfunction filterNullishHeaders(\n headers: Record<string, string> | undefined\n): Record<string, string> {\n if (!headers) return {};\n const out: Record<string, string> = {};\n for (const [k, v] of Object.entries(headers)) {\n // Accept anything that survives the truthy guard; the type is\n // `Record<string, string>` but callers occasionally cast with\n // `as any` to slip nulls through.\n if (v !== null && v !== undefined) out[k] = v;\n }\n return out;\n}\n\nfunction parseRetryAfter(header: string | null): number | undefined {\n if (!header) return undefined;\n const asNumber = Number.parseFloat(header);\n if (Number.isFinite(asNumber)) return asNumber;\n const asDate = Date.parse(header);\n if (Number.isFinite(asDate)) return Math.max(0, (asDate - Date.now()) / 1000);\n return undefined;\n}\n","// AUTOGENERATED by nebula-sdks/generator. Do not edit by hand.\n// Source: nebula-sdks/openapi/openapi.json\n\nimport type { components } from \"../types.ts\";\nimport type { NebulaCore } from \"../runtime/client.ts\";\n\nexport interface RequestOptions {\n signal?: AbortSignal;\n}\n\nexport class ClientResource {\n constructor(private readonly core: NebulaCore) {}\n\n /**\n *\n * Health probe\n * \n * Lightweight liveness probe. Returns a 200 with a fixed message when the API process is up. Does not verify downstream dependencies (database, storage, workers) — use the internal status endpoints for those.\n * @operationId client.health\n * @endpoint GET /v1/health\n */\n async health(options?: RequestOptions): Promise<components[\"schemas\"][\"WrappedGenericMessageResponse\"]> {\n return this.core.request<components[\"schemas\"][\"WrappedGenericMessageResponse\"]>({\n method: \"GET\",\n path: \"/v1/health\",\n pathParams: {},\n query: undefined,\n idempotent: true,\n signal: options?.signal,\n });\n }\n\n}","// AUTOGENERATED by nebula-sdks/generator. Do not edit by hand.\n// Source: nebula-sdks/openapi/openapi.json\n\nimport type { components } from \"../types.ts\";\nimport type { NebulaCore } from \"../runtime/client.ts\";\n\nexport interface RequestOptions {\n signal?: AbortSignal;\n}\n\nexport class CollectionsResource {\n constructor(private readonly core: NebulaCore) {}\n\n /**\n *\n * Create a new collection\n * \n * Create a new collection and automatically add the creating user\n * to it.\n * \n * This endpoint allows authenticated users to create a new collection\n * with a specified name and optional description. The user creating\n * the collection is automatically added as a member.\n * @operationId collections.create\n * @endpoint POST /v1/collections\n */\n async create(\n params: {\n body: components[\"schemas\"][\"CreateCollectionRequest\"];\n},\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"WrappedCollectionResponse\"]> {\n return this.core.request<components[\"schemas\"][\"WrappedCollectionResponse\"]>({\n method: \"POST\",\n path: \"/v1/collections\",\n pathParams: {},\n query: undefined,\n body: params.body,\n idempotent: false,\n signal: options?.signal,\n });\n }\n\n /**\n *\n * Delete collection\n * \n * Delete an existing collection.\n * \n * This endpoint allows deletion of a collection identified by its\n * UUID. The user must have appropriate permissions to delete the\n * collection. Deleting a collection removes all associations but does\n * not delete the engrams within it.\n * @operationId collections.delete\n * @endpoint DELETE /v1/collections/{id}\n */\n async delete(\n id: string,\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"WrappedGenericBooleanResponse\"]> {\n return this.core.request<components[\"schemas\"][\"WrappedGenericBooleanResponse\"]>({\n method: \"DELETE\",\n path: \"/v1/collections/{id}\",\n pathParams: { id: id },\n query: undefined,\n idempotent: true,\n signal: options?.signal,\n });\n }\n\n /**\n *\n * List collections\n * \n * Returns a cursor-paginated list of collections the authenticated\n * user has access to.\n * \n * Results can be filtered by providing specific collection IDs.\n * Regular users will only see collections they own or have access to.\n * Superusers can see all collections.\n * \n * The collections are returned in order of last modification, with\n * most recent first.\n * @operationId collections.list\n * @endpoint GET /v1/collections\n */\n async list(\n params: {\n /** A list of collection IDs to retrieve. If not provided, all collections will be returned. */\n ids?: Array<string>;\n /** Filter collections by name (case-insensitive exact match). */\n name?: string | null;\n /** Opaque pagination cursor. Pass the ``next_cursor`` from a previous response to fetch the next page. */\n cursor?: string | null;\n /** Specifies a limit on the number of objects to return, ranging between 1 and 1000. Defaults to 100. */\n limit?: number;\n /** If true, only returns collections owned by the user, not all accessible collections. */\n ownerOnly?: boolean;\n /** Filter by workspace ID. Pass a UUID to scope to a workspace, or omit for all. */\n workspaceId?: string | null;\n} = {},\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"PaginatedCollectionResponse\"]> {\n return this.core.request<components[\"schemas\"][\"PaginatedCollectionResponse\"]>({\n method: \"GET\",\n path: \"/v1/collections\",\n pathParams: {},\n query: { ids: params.ids, name: params.name, cursor: params.cursor, limit: params.limit, owner_only: params.ownerOnly, workspace_id: params.workspaceId },\n idempotent: true,\n signal: options?.signal,\n });\n }\n\n /**\n *\n * Get collection details\n * \n * Get details of a specific collection.\n * \n * This endpoint retrieves detailed information about a single\n * collection identified by its UUID. The user must have access to the\n * collection to view its details.\n * @operationId collections.retrieve\n * @endpoint GET /v1/collections/{id}\n */\n async retrieve(\n id: string,\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"WrappedCollectionResponse\"]> {\n return this.core.request<components[\"schemas\"][\"WrappedCollectionResponse\"]>({\n method: \"GET\",\n path: \"/v1/collections/{id}\",\n pathParams: { id: id },\n query: undefined,\n idempotent: true,\n signal: options?.signal,\n });\n }\n\n /**\n *\n * Get a collection by name\n * \n * Retrieve a collection by its (owner_id, name) combination.\n * \n * The authenticated user can only fetch collections they own, or, if\n * superuser, from anyone.\n * @operationId collections.retrieveByName\n * @endpoint GET /v1/collections/name/{collection_name}\n */\n async retrieveByName(\n params: {\n /** The name of the collection */\n collectionName: string;\n /** (Superuser only) Specify the owner_id to retrieve a collection by name */\n ownerId?: string | null;\n},\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"WrappedCollectionResponse\"]> {\n return this.core.request<components[\"schemas\"][\"WrappedCollectionResponse\"]>({\n method: \"GET\",\n path: \"/v1/collections/name/{collection_name}\",\n pathParams: { collection_name: params.collectionName },\n query: { owner_id: params.ownerId },\n idempotent: true,\n signal: options?.signal,\n });\n }\n\n /**\n *\n * Update collection\n * \n * Update an existing collection's configuration.\n * \n * This endpoint allows updating the name, description, and access settings of an\n * existing collection. The user must have appropriate permissions to\n * modify the collection.\n * @operationId collections.update\n * @endpoint POST /v1/collections/{id}\n */\n async update(\n params: {\n /** The unique identifier of the collection to update */\n id: string;\n body: components[\"schemas\"][\"UpdateCollectionRequest\"];\n},\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"WrappedCollectionResponse\"]> {\n return this.core.request<components[\"schemas\"][\"WrappedCollectionResponse\"]>({\n method: \"POST\",\n path: \"/v1/collections/{id}\",\n pathParams: { id: params.id },\n query: undefined,\n body: params.body,\n idempotent: false,\n signal: options?.signal,\n });\n }\n\n}","// AUTOGENERATED by nebula-sdks/generator. Do not edit by hand.\n// Source: nebula-sdks/openapi/openapi.json\n\nimport type { components } from \"../types.ts\";\nimport type { NebulaCore } from \"../runtime/client.ts\";\n\nexport interface RequestOptions {\n signal?: AbortSignal;\n}\n\nexport class ConnectorsResource {\n constructor(private readonly core: NebulaCore) {}\n\n /**\n *\n * Start OAuth connection flow\n * \n * Start the OAuth connection flow for the given external provider. Returns the authorization URL the user should visit to grant Nebula access. After consent the provider redirects back to Nebula and the connection becomes active.\n * @operationId connectors.connect\n * @endpoint POST /v1/connectors/{provider}/connect\n */\n async connect(\n params: {\n provider: string;\n body: components[\"schemas\"][\"ConnectRequest\"];\n},\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"WrappedConnectorConnectResponse\"]> {\n return this.core.request<components[\"schemas\"][\"WrappedConnectorConnectResponse\"]>({\n method: \"POST\",\n path: \"/v1/connectors/{provider}/connect\",\n pathParams: { provider: params.provider },\n query: undefined,\n body: params.body,\n idempotent: false,\n signal: options?.signal,\n });\n }\n\n /**\n *\n * Disconnect an external data source\n * \n * Disconnect the named connection, revoking the stored OAuth credentials and stopping future syncs. Optionally pass `delete_memories=true` to also remove every memory this connection had ingested.\n * @operationId connectors.disconnect\n * @endpoint DELETE /v1/connectors/{connection_id}\n */\n async disconnect(\n params: {\n connectionId: string;\n deleteMemories?: boolean;\n},\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"WrappedConnectorDisconnectResponse\"]> {\n return this.core.request<components[\"schemas\"][\"WrappedConnectorDisconnectResponse\"]>({\n method: \"DELETE\",\n path: \"/v1/connectors/{connection_id}\",\n pathParams: { connection_id: params.connectionId },\n query: { delete_memories: params.deleteMemories },\n idempotent: true,\n signal: options?.signal,\n });\n }\n\n /**\n *\n * List active connections for a collection\n * \n * Return every connector connection associated with the given collection, with encrypted credentials redacted. Useful for showing the user which third-party data sources are wired up to a collection.\n * @operationId connectors.list\n * @endpoint GET /v1/connectors\n */\n async list(\n params: {\n collectionId: string;\n},\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"WrappedListOfConnectorConnectionResponse\"]> {\n return this.core.request<components[\"schemas\"][\"WrappedListOfConnectorConnectionResponse\"]>({\n method: \"GET\",\n path: \"/v1/connectors\",\n pathParams: {},\n query: { collection_id: params.collectionId },\n idempotent: true,\n signal: options?.signal,\n });\n }\n\n /**\n *\n * List available connector providers\n * \n * Return the set of connector provider identifiers (e.g. `google_drive`, `slack`) that this Nebula instance is configured to expose. Pass one of these to `POST /connectors/{provider}/connect` to start an OAuth flow.\n * @operationId connectors.listProviders\n * @endpoint GET /v1/connectors/providers\n */\n async listProviders(options?: RequestOptions): Promise<components[\"schemas\"][\"WrappedListOfStr\"]> {\n return this.core.request<components[\"schemas\"][\"WrappedListOfStr\"]>({\n method: \"GET\",\n path: \"/v1/connectors/providers\",\n pathParams: {},\n query: undefined,\n idempotent: true,\n signal: options?.signal,\n });\n }\n\n /**\n *\n * Get a single connection by ID\n * \n * Fetch a single connector connection by its UUID. Returns the connection metadata plus whether the underlying subscription is active. Encrypted credentials are never returned to clients.\n * @operationId connectors.retrieve\n * @endpoint GET /v1/connectors/{connection_id}\n */\n async retrieve(\n connectionId: string,\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"WrappedConnectorConnectionResponse\"]> {\n return this.core.request<components[\"schemas\"][\"WrappedConnectorConnectionResponse\"]>({\n method: \"GET\",\n path: \"/v1/connectors/{connection_id}\",\n pathParams: { connection_id: connectionId },\n query: undefined,\n idempotent: true,\n signal: options?.signal,\n });\n }\n\n /**\n *\n * Manually trigger a sync\n * \n * Schedule an immediate sync for an active connection, bypassing the normal cadence. Returns 409 if a sync is already in progress and 400 if the connection isn't in the `active` state.\n * @operationId connectors.sync\n * @endpoint POST /v1/connectors/{connection_id}/sync\n */\n async sync(\n connectionId: string,\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"WrappedConnectorSyncResponse\"]> {\n return this.core.request<components[\"schemas\"][\"WrappedConnectorSyncResponse\"]>({\n method: \"POST\",\n path: \"/v1/connectors/{connection_id}/sync\",\n pathParams: { connection_id: connectionId },\n query: undefined,\n idempotent: true,\n signal: options?.signal,\n });\n }\n\n}","// AUTOGENERATED by nebula-sdks/generator. Do not edit by hand.\n// Source: nebula-sdks/openapi/openapi.json\n\nimport type { components } from \"../types.ts\";\nimport type { NebulaCore } from \"../runtime/client.ts\";\n\nexport interface RequestOptions {\n signal?: AbortSignal;\n}\n\nexport class MemoriesResource {\n constructor(private readonly core: NebulaCore) {}\n\n /**\n *\n * Append content to an engram\n * \n * Append content to an existing engram.\n * \n * **For conversation engrams:**\n * - Provide `messages` array with content, role, and optional metadata\n * - Works like `/conversations/{id}/messages` endpoint\n * \n * **For document engrams:**\n * - Provide either `raw_text` or `chunks` to append additional content\n * - Content will be processed and added to the engram\n * @operationId memories.append\n * @endpoint POST /v1/memories/{id}/append\n */\n async append(\n params: {\n /** The unique identifier of the engram */\n id: string;\n body: components[\"schemas\"][\"AppendMemoryRequest\"];\n},\n options?: RequestOptions,\n ): Promise<unknown> {\n return this.core.request<unknown>({\n method: \"POST\",\n path: \"/v1/memories/{id}/append\",\n pathParams: { id: params.id },\n query: undefined,\n body: params.body,\n idempotent: false,\n signal: options?.signal,\n });\n }\n\n /**\n *\n * Create a new memory (conversation or document)\n * \n * Create a new memory (conversation or document) using clean JSON body.\n * \n * - Use `collection_id` (UUID)\n * - `kind` is optional and inferred from payload shape:\n * - If `messages` present -> conversation\n * - Otherwise -> document\n * - For conversations: provide `messages` array\n * - For documents: provide `raw_text` or `chunks`\n * - Use `snapshot` for device-memory mode (mutually exclusive with collection_id)\n * @operationId memories.create\n * @endpoint POST /v1/memories\n */\n async create(\n params: {\n body: components[\"schemas\"][\"CreateMemoryRequest\"];\n},\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"MemoryCreateResponse\"]> {\n return this.core.request<components[\"schemas\"][\"MemoryCreateResponse\"]>({\n method: \"POST\",\n path: \"/v1/memories\",\n pathParams: {},\n query: undefined,\n body: params.body,\n idempotent: false,\n signal: options?.signal,\n });\n }\n\n /**\n *\n * Get presigned URL for large file upload\n * \n * Get a presigned URL for uploading large files directly to S3.\n * \n * Use this for files larger than 5MB that cannot be sent inline as base64.\n * After uploading, reference the file in memory creation using S3FileReference.\n * \n * Args:\n * filename: Original filename (e.g., \"image.jpg\")\n * content_type: MIME type (e.g., \"image/jpeg\", \"application/pdf\")\n * file_size: Expected file size in bytes (max 100MB)\n * \n * Returns:\n * dict with:\n * - upload_url: Presigned URL for PUT request (expires in 1 hour)\n * - upload_headers: Headers that must be sent with the presigned PUT request\n * - s3_key: The S3 key to reference in memory creation\n * - bucket: S3 bucket name\n * - expires_in: Seconds until URL expires\n * - max_size: Maximum allowed file size\n * @operationId memories.createUpload\n * @endpoint POST /v1/memories/upload\n */\n async createUpload(\n params: {\n /** Original filename (e.g., 'image.jpg') */\n filename: string;\n /** MIME type (e.g., 'image/jpeg', 'application/pdf') */\n contentType: string;\n /** Expected file size in bytes (max 100MB) */\n fileSize: number;\n},\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"WrappedPresignedUploadResponse\"]> {\n return this.core.request<components[\"schemas\"][\"WrappedPresignedUploadResponse\"]>({\n method: \"POST\",\n path: \"/v1/memories/upload\",\n pathParams: {},\n query: { filename: params.filename, content_type: params.contentType, file_size: params.fileSize },\n idempotent: false,\n signal: options?.signal,\n });\n }\n\n /**\n *\n * Delete an engram\n * \n * Delete a specific engram with graph awareness. All chunks corresponding to the\n * engram are deleted, and graph components (entities/relationships) are updated\n * or deleted based on remaining chunk references from other engrams.\n * \n * This method now properly handles graph components and maintains graph integrity\n * for search operations.\n * @operationId memories.delete\n * @endpoint DELETE /v1/memories/{id}\n */\n async delete(\n id: string,\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"WrappedGenericBooleanResponse\"]> {\n return this.core.request<components[\"schemas\"][\"WrappedGenericBooleanResponse\"]>({\n method: \"DELETE\",\n path: \"/v1/memories/{id}\",\n pathParams: { id: id },\n query: undefined,\n idempotent: false,\n signal: options?.signal,\n });\n }\n\n /**\n *\n * Delete one or more engrams\n * \n * Delete one or more engrams.\n * \n * This endpoint efficiently handles both single and batch deletions.\n * When multiple IDs are provided, it uses optimized batch operations.\n * \n * Args:\n * ids: Either a single UUID or a list of UUIDs to delete\n * \n * Returns:\n * For single deletion: boolean success response\n * For batch deletion: detailed results with successful and failed deletions\n * @operationId memories.deleteMany\n * @endpoint POST /v1/memories/delete\n */\n async deleteMany(\n params: {\n body: components[\"schemas\"][\"DeleteMemoriesRequest\"];\n},\n options?: RequestOptions,\n ): Promise<unknown> {\n return this.core.request<unknown>({\n method: \"POST\",\n path: \"/v1/memories/delete\",\n pathParams: {},\n query: undefined,\n body: params.body,\n idempotent: false,\n signal: options?.signal,\n });\n }\n\n /**\n *\n * Delete a previously uploaded S3 file\n * \n * Delete a file from S3 that was uploaded via a presigned URL.\n * Verifies the caller owns the file via S3 object metadata.\n * @operationId memories.deleteUpload\n * @endpoint DELETE /v1/memories/upload\n */\n async deleteUpload(\n params: {\n /** S3 key of the file to delete (returned by POST /memories/upload) */\n s3Key: string;\n},\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"WrappedGenericMessageResponse\"]> {\n return this.core.request<components[\"schemas\"][\"WrappedGenericMessageResponse\"]>({\n method: \"DELETE\",\n path: \"/v1/memories/upload\",\n pathParams: {},\n query: { s3_key: params.s3Key },\n idempotent: true,\n signal: options?.signal,\n });\n }\n\n /**\n *\n * List engrams\n * \n * Returns a cursor-paginated list of engrams the authenticated user\n * has access to.\n * \n * Results can be filtered by providing specific engram IDs or collection IDs.\n * Regular users will only see engrams they own or have access to through\n * collections. Superusers can see all engrams.\n * \n * The engrams are returned in order of creation time, most recent\n * first. The response includes the engram's text field if available.\n * @operationId memories.list\n * @endpoint GET /v1/memories\n */\n async list(\n params: {\n /** A list of engram IDs to retrieve. If not provided, all engrams will be returned. */\n ids?: Array<string>;\n /** Opaque pagination cursor. Pass the ``next_cursor`` from a previous response to fetch the next page. */\n cursor?: string | null;\n /** Specifies a limit on the number of objects to return, ranging between 1 and 1000. Defaults to 100. */\n limit?: number;\n /** Maximum chunks to inline per engram. Defaults to all chunks for backwards compatibility; pass 0 to skip chunk hydration. */\n chunksLimit?: number | null;\n /** If true, only returns engrams owned by the user, not all accessible engrams. */\n ownerOnly?: boolean;\n /** Optional list of collection IDs to filter engrams by. If provided, exactly one collection ID must be specified. */\n collectionIds?: Array<string> | null;\n /** JSON string for metadata filtering. Example: '{\"metadata.source\": {\"$eq\": \"playground\"}}' */\n metadataFilters?: string | null;\n /** Read-your-writes assertion: the WAL-tail overlay path waits for at least this seq to be applied before serving (or returns 503 Unavailable on timeout). REQUIRES exactly one collection_ids entry — without a collection scope the request returns 422 (the per-WAL-shard scalar applied_wal_seq is meaningless across collections). When the served shard has not been migrated to wal_compaction_enabled, the field is accepted but the served path is the legacy overlay (the assertion has no effect — the response's applied_wal_seq will be 0). Pass back the value the matching upload response surfaced. */\n minAppliedWalSeq?: number | null;\n} = {},\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"PaginatedListedEngram\"]> {\n return this.core.request<components[\"schemas\"][\"PaginatedListedEngram\"]>({\n method: \"GET\",\n path: \"/v1/memories\",\n pathParams: {},\n query: { ids: params.ids, cursor: params.cursor, limit: params.limit, chunks_limit: params.chunksLimit, owner_only: params.ownerOnly, collection_ids: params.collectionIds, metadata_filters: params.metadataFilters, min_applied_wal_seq: params.minAppliedWalSeq },\n idempotent: true,\n signal: options?.signal,\n });\n }\n\n /**\n *\n * Recall workflow patterns by intent\n * \n * Workflow-pattern recall over 5 intents.\n * \n * * ``cursor`` -- match the caller's anchor against pattern\n * canonical states, return ranked patterns + position.\n * * ``predict`` -- like cursor but include the predicted next\n * trace from each pattern's canonical instance.\n * * ``resume`` -- like cursor, biased toward longer patterns.\n * * ``evidence`` -- expand a specific pattern via\n * ``hydrate_pattern``.\n * * ``bootstrap`` -- top-K patterns by confidence with no anchor.\n * @operationId memories.recallWorkflow\n * @endpoint POST /v1/memories/workflow/recall\n */\n async recallWorkflow(\n params: {\n body: components[\"schemas\"][\"CursorRecallRequest\"] | components[\"schemas\"][\"PredictRecallRequest\"] | components[\"schemas\"][\"ResumeRecallRequest\"] | components[\"schemas\"][\"EvidenceRecallRequest\"] | components[\"schemas\"][\"BootstrapRecallRequest\"];\n},\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"WorkflowRecallResponse\"]> {\n return this.core.request<components[\"schemas\"][\"WorkflowRecallResponse\"]>({\n method: \"POST\",\n path: \"/v1/memories/workflow/recall\",\n pathParams: {},\n query: undefined,\n body: params.body,\n idempotent: false,\n signal: options?.signal,\n });\n }\n\n /**\n *\n * Retrieve an engram\n * \n * Retrieves detailed information about a specific engram by its\n * ID.\n * \n * This endpoint returns the engram's metadata, status, and system information. It does not\n * return the engram's content - use the `/engrams/{id}/download` endpoint for that.\n * \n * Users can only retrieve engrams they own or have access to through collections.\n * Superusers can retrieve any engram.\n * @operationId memories.retrieve\n * @endpoint GET /v1/memories/{id}\n */\n async retrieve(\n id: string,\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"WrappedEngram\"]> {\n return this.core.request<components[\"schemas\"][\"WrappedEngram\"]>({\n method: \"GET\",\n path: \"/v1/memories/{id}\",\n pathParams: { id: id },\n query: undefined,\n idempotent: true,\n signal: options?.signal,\n });\n }\n\n /**\n *\n * Search memories\n * \n * Perform a search query across your memories.\n * \n * **Standard mode** (collection_ids or readable-scope search): returns hierarchical MemoryRecall\n * with semantics, episodes, procedures, and sources.\n * \n * **Snapshot mode** (snapshot field): returns graph-search results with\n * {entities, relationships} from stateless in-memory traversal.\n * @operationId memories.search\n * @endpoint POST /v1/memories/search\n */\n async search(\n params: {\n body: components[\"schemas\"][\"MemorySearchRequest\"];\n},\n options?: RequestOptions,\n ): Promise<unknown> {\n return this.core.request<unknown>({\n method: \"POST\",\n path: \"/v1/memories/search\",\n pathParams: {},\n query: undefined,\n body: params.body,\n idempotent: false,\n signal: options?.signal,\n });\n }\n\n /**\n *\n * Update a memory\n * \n * Update memory-level properties including name, metadata, and collection associations.\n * \n * This endpoint allows updating properties of an entire memory (document or conversation)\n * without modifying its content:\n * - **name**: Updates the authoritative engram title\n * - **metadata**: Can replace or merge with existing metadata\n * - **collection_ids**: Updates authoritative engram collection associations\n * \n * Users can only update memories they own or have access to through collections.\n * At least one collection association must be maintained.\n * \n * If collection_id is provided and the engram is shared across collections, a copy-on-write\n * will be performed to create a collection-specific copy before modification.\n * @operationId memories.update\n * @endpoint PATCH /v1/memories/{id}\n */\n async update(\n params: {\n /** The unique identifier of the memory */\n id: string;\n /** Collection context for copy-on-write. If provided and engram is shared, creates a copy before modification. */\n collectionId?: string | null;\n body: components[\"schemas\"][\"UpdateMemoryRequest\"];\n},\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"WrappedEngram\"]> {\n return this.core.request<components[\"schemas\"][\"WrappedEngram\"]>({\n method: \"PATCH\",\n path: \"/v1/memories/{id}\",\n pathParams: { id: params.id },\n query: { collection_id: params.collectionId },\n body: params.body,\n idempotent: false,\n signal: options?.signal,\n });\n }\n\n}","// AUTOGENERATED by nebula-sdks/generator. Do not edit by hand.\n// Source: nebula-sdks/openapi/openapi.json\n\nimport type { components } from \"../types.ts\";\nimport type { NebulaCore } from \"../runtime/client.ts\";\n\nexport interface RequestOptions {\n signal?: AbortSignal;\n}\n\nexport class SnapshotsResource {\n constructor(private readonly core: NebulaCore) {}\n\n /**\n *\n * Export a collection snapshot\n * \n * Export a collection's full graph state as a\n * portable SnapshotEnvelope.\n * @operationId snapshots.export\n * @endpoint POST /v1/device-memory/snapshot/export\n */\n async export(\n params: {\n body: components[\"schemas\"][\"SnapshotExportRequest\"];\n},\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"WrappedSnapshotEnvelope\"]> {\n return this.core.request<components[\"schemas\"][\"WrappedSnapshotEnvelope\"]>({\n method: \"POST\",\n path: \"/v1/device-memory/snapshot/export\",\n pathParams: {},\n query: undefined,\n body: params.body,\n idempotent: true,\n signal: options?.signal,\n });\n }\n\n /**\n *\n * Import a snapshot into an ephemeral collection\n * \n * Import a SnapshotEnvelope into an ephemeral\n * collection. Returns the ephemeral collection UUID.\n * @operationId snapshots.import\n * @endpoint POST /v1/device-memory/snapshot/import\n */\n async import(\n params: {\n body: components[\"schemas\"][\"SnapshotImportRequest\"];\n},\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"WrappedSnapshotImportResult\"]> {\n return this.core.request<components[\"schemas\"][\"WrappedSnapshotImportResult\"]>({\n method: \"POST\",\n path: \"/v1/device-memory/snapshot/import\",\n pathParams: {},\n query: undefined,\n body: params.body,\n idempotent: false,\n signal: options?.signal,\n });\n }\n\n}","// AUTOGENERATED by nebula-sdks/generator. Do not edit by hand.\n// Source: nebula-sdks/openapi/openapi.json\n\nimport { NebulaCore, type ClientOptions } from \"./runtime/client.ts\";\nimport { ClientResource } from \"./resources/client.ts\";\nimport { CollectionsResource } from \"./resources/collections.ts\";\nimport { ConnectorsResource } from \"./resources/connectors.ts\";\nimport { MemoriesResource } from \"./resources/memories.ts\";\nimport { SnapshotsResource } from \"./resources/snapshots.ts\";\n\nexport class NebulaClient {\n protected readonly core: NebulaCore;\n readonly client: ClientResource;\n readonly collections: CollectionsResource;\n readonly connectors: ConnectorsResource;\n readonly memories: MemoriesResource;\n readonly snapshots: SnapshotsResource;\n\n constructor(options: ClientOptions = {}) {\n this.core = new NebulaCore(options);\n this.client = new ClientResource(this.core);\n this.collections = new CollectionsResource(this.core);\n this.connectors = new ConnectorsResource(this.core);\n this.memories = new MemoriesResource(this.core);\n this.snapshots = new SnapshotsResource(this.core);\n }\n}","// AUTOGENERATED by nebula-sdks/generator. Do not edit by hand.\n// Source: nebula-sdks/config/dx-extensions.yaml\n\nimport { NebulaClient } from \"../client.ts\";\n\n/**\n * Conditional type matching the runtime envelope-unwrap. If T has a\n * `results` field, narrow to it; otherwise pass through.\n */\ntype Unwrapped<T> = T extends { results: infer R } ? R : T;\n\n/** Strip a `results` envelope at runtime; matches `Unwrapped<>`. */\nfunction unwrap<T>(p: Promise<T>): Promise<Unwrapped<T>> {\n return p.then((r) => {\n if (r !== null && typeof r === \"object\" && \"results\" in r) {\n return (r as { results: unknown }).results as Unwrapped<T>;\n }\n return r as Unwrapped<T>;\n });\n}\n\n/**\n * Generated DX layer: simple unwrap/passthrough convenience methods.\n * Signatures are derived from the underlying resource methods so\n * callers see the same arg names + types in IDE hover.\n */\nexport class NebulaDX extends NebulaClient {\n /** Retrieve a single memory by id and return just the data. (generated from dx-extensions.yaml). */\n async getMemory(...args: Parameters<NebulaClient[\"memories\"][\"retrieve\"]>): Promise<Unwrapped<Awaited<ReturnType<NebulaClient[\"memories\"][\"retrieve\"]>>>> {\n return unwrap<Awaited<ReturnType<NebulaClient[\"memories\"][\"retrieve\"]>>>(this.memories.retrieve(...args));\n }\n\n /** Update a memory by id; returns the updated record. (generated from dx-extensions.yaml). */\n async updateMemory(...args: Parameters<NebulaClient[\"memories\"][\"update\"]>): Promise<Unwrapped<Awaited<ReturnType<NebulaClient[\"memories\"][\"update\"]>>>> {\n return unwrap<Awaited<ReturnType<NebulaClient[\"memories\"][\"update\"]>>>(this.memories.update(...args));\n }\n\n /** Liveness probe with the wire envelope unwrapped. (generated from dx-extensions.yaml). */\n async healthCheck(...args: Parameters<NebulaClient[\"client\"][\"health\"]>): Promise<Unwrapped<Awaited<ReturnType<NebulaClient[\"client\"][\"health\"]>>>> {\n return unwrap<Awaited<ReturnType<NebulaClient[\"client\"][\"health\"]>>>(this.client.health(...args));\n }\n\n /** unwrap → collections.create (generated from dx-extensions.yaml). */\n async createCollection(...args: Parameters<NebulaClient[\"collections\"][\"create\"]>): Promise<Unwrapped<Awaited<ReturnType<NebulaClient[\"collections\"][\"create\"]>>>> {\n return unwrap<Awaited<ReturnType<NebulaClient[\"collections\"][\"create\"]>>>(this.collections.create(...args));\n }\n\n /** unwrap → collections.retrieve (generated from dx-extensions.yaml). */\n async getCollection(...args: Parameters<NebulaClient[\"collections\"][\"retrieve\"]>): Promise<Unwrapped<Awaited<ReturnType<NebulaClient[\"collections\"][\"retrieve\"]>>>> {\n return unwrap<Awaited<ReturnType<NebulaClient[\"collections\"][\"retrieve\"]>>>(this.collections.retrieve(...args));\n }\n\n /** unwrap → collections.retrieveByName (generated from dx-extensions.yaml). */\n async getCollectionByName(...args: Parameters<NebulaClient[\"collections\"][\"retrieveByName\"]>): Promise<Unwrapped<Awaited<ReturnType<NebulaClient[\"collections\"][\"retrieveByName\"]>>>> {\n return unwrap<Awaited<ReturnType<NebulaClient[\"collections\"][\"retrieveByName\"]>>>(this.collections.retrieveByName(...args));\n }\n\n /** unwrap → collections.list (generated from dx-extensions.yaml). */\n async listCollections(...args: Parameters<NebulaClient[\"collections\"][\"list\"]>): Promise<Unwrapped<Awaited<ReturnType<NebulaClient[\"collections\"][\"list\"]>>>> {\n return unwrap<Awaited<ReturnType<NebulaClient[\"collections\"][\"list\"]>>>(this.collections.list(...args));\n }\n\n /** unwrap → collections.update (generated from dx-extensions.yaml). */\n async updateCollection(...args: Parameters<NebulaClient[\"collections\"][\"update\"]>): Promise<Unwrapped<Awaited<ReturnType<NebulaClient[\"collections\"][\"update\"]>>>> {\n return unwrap<Awaited<ReturnType<NebulaClient[\"collections\"][\"update\"]>>>(this.collections.update(...args));\n }\n\n /** unwrap → connectors.listProviders (generated from dx-extensions.yaml). */\n async listProviders(...args: Parameters<NebulaClient[\"connectors\"][\"listProviders\"]>): Promise<Unwrapped<Awaited<ReturnType<NebulaClient[\"connectors\"][\"listProviders\"]>>>> {\n return unwrap<Awaited<ReturnType<NebulaClient[\"connectors\"][\"listProviders\"]>>>(this.connectors.listProviders(...args));\n }\n\n /** unwrap → connectors.retrieve (generated from dx-extensions.yaml). */\n async getConnection(...args: Parameters<NebulaClient[\"connectors\"][\"retrieve\"]>): Promise<Unwrapped<Awaited<ReturnType<NebulaClient[\"connectors\"][\"retrieve\"]>>>> {\n return unwrap<Awaited<ReturnType<NebulaClient[\"connectors\"][\"retrieve\"]>>>(this.connectors.retrieve(...args));\n }\n\n /** unwrap → connectors.sync (generated from dx-extensions.yaml). */\n async triggerSync(...args: Parameters<NebulaClient[\"connectors\"][\"sync\"]>): Promise<Unwrapped<Awaited<ReturnType<NebulaClient[\"connectors\"][\"sync\"]>>>> {\n return unwrap<Awaited<ReturnType<NebulaClient[\"connectors\"][\"sync\"]>>>(this.connectors.sync(...args));\n }\n\n /** unwrap → memories.createUpload (generated from dx-extensions.yaml). */\n async getUploadUrl(...args: Parameters<NebulaClient[\"memories\"][\"createUpload\"]>): Promise<Unwrapped<Awaited<ReturnType<NebulaClient[\"memories\"][\"createUpload\"]>>>> {\n return unwrap<Awaited<ReturnType<NebulaClient[\"memories\"][\"createUpload\"]>>>(this.memories.createUpload(...args));\n }\n\n /** unwrap → snapshots.export (generated from dx-extensions.yaml). */\n async exportSnapshot(...args: Parameters<NebulaClient[\"snapshots\"][\"export\"]>): Promise<Unwrapped<Awaited<ReturnType<NebulaClient[\"snapshots\"][\"export\"]>>>> {\n return unwrap<Awaited<ReturnType<NebulaClient[\"snapshots\"][\"export\"]>>>(this.snapshots.export(...args));\n }\n\n /** unwrap → snapshots.import (generated from dx-extensions.yaml). */\n async importSnapshot(...args: Parameters<NebulaClient[\"snapshots\"][\"import\"]>): Promise<Unwrapped<Awaited<ReturnType<NebulaClient[\"snapshots\"][\"import\"]>>>> {\n return unwrap<Awaited<ReturnType<NebulaClient[\"snapshots\"][\"import\"]>>>(this.snapshots.import(...args));\n }\n\n}","// Handwritten Nebula DX layer.\n//\n// Carries only the methods that need real dispatch logic (storeMemory's\n// create-vs-append branch, polymorphic delete, search-affinity headers,\n// auth normalization, response-shape coercion to bool). The simple\n// unwrap/passthrough methods (getMemory, updateCollection, exportSnapshot,\n// listProviders, ...) are generated from\n// `nebula-sdks/config/dx-extensions.yaml` into `_dx_generated.ts`, which\n// this class extends via `NebulaDX`.\n//\n// Source of truth: nebula-sdks/custom/typescript/dx.ts\n// The generator copies this file into sdks/typescript/src/lib/dx.ts on every\n// `bun run generate`. Edit the source, not the copy.\n\nimport { NebulaDX } from \"./_dx_generated.ts\";\nimport {\n type ClientOptions,\n type components,\n} from \"../index.ts\";\n\ntype Schemas = components[\"schemas\"];\ntype SnapshotEnvelopeInput = Schemas[\"SnapshotEnvelope-Input\"];\ntype SnapshotEnvelopeOutput = Schemas[\"SnapshotEnvelope-Output\"];\n\ntype ResultsOf<T> = T extends { results: infer R } ? R : T;\ntype RequestPath = `/${string}` | `http://${string}` | `https://${string}`;\n\nexport type CompatClientOptions = ClientOptions & {\n api_key?: string | null;\n apiKey?: string | null;\n baseUrl?: string | null;\n // Stainless-shape alias with capital-URL casing. Existing frontend\n // callers (CollectionService, MemoryService, PlaygroundService, etc.)\n // pass `baseURL`; without this alias the value falls through unused\n // and the runtime defaults to api.zeroset.com.\n baseURL?: string | null;\n base_url?: string | null;\n // Stainless-shape alias for `timeoutMs`. Same compat reason.\n timeout?: number | null;\n accessToken?: string | null;\n bearerToken?: string | null;\n bearer_token?: string | null;\n access_token?: string | null;\n};\n\nexport interface MemoryCommonInput {\n collection_id?: string | null;\n collectionId?: string | null;\n content?: string | string[] | unknown[] | null;\n raw_text?: string | null;\n chunks?: Array<string> | null;\n messages?: unknown[] | null;\n metadata?: { [key: string]: unknown } | null;\n ingestion_config?: unknown;\n ingestion_mode?: string | null;\n}\n\nexport interface MemoryCreateInput extends MemoryCommonInput {\n name?: string | null;\n speaker_id?: string | null;\n speaker_name?: string | null;\n content_parts?: unknown[] | null;\n contents?: string[] | null;\n snapshot?: SnapshotEnvelopeInput | null;\n memory_id?: undefined | null;\n}\n\nexport interface MemoryAppendInput extends Omit<MemoryCommonInput, \"ingestion_mode\" | \"messages\"> {\n memory_id: string;\n ingestion_mode?: string | null;\n messages?: unknown[] | null;\n}\n\nexport type MemoryInput = MemoryCreateInput | MemoryAppendInput;\n\ntype MemoryCreateBody = Schemas[\"CreateMemoryRequest\"];\ntype MemoryAppendBody = Schemas[\"AppendMemoryRequest\"];\n\nexport class Nebula extends NebulaDX {\n constructor(options: CompatClientOptions = {}) {\n super(normalizeAuthOptions(normalizeClientOptions(options)));\n }\n\n /**\n * Polymorphic memory creator: dispatches to memories.create or memories.append\n * based on whether `memory_id` is set on the input. Returns the new memory's\n * id (string), or — when `snapshot` is set — the updated snapshot envelope.\n */\n async storeMemory(\n memory: MemoryInput,\n options?: { signal?: AbortSignal }\n ): Promise<string | SnapshotEnvelopeOutput> {\n if (\"memory_id\" in memory && memory.memory_id != null) {\n const memoryID = memory.memory_id;\n await this.memories.append(\n { id: memoryID, body: toMemoryAppendParams(memory) },\n options\n );\n return memoryID;\n }\n const response = await this.memories.create(\n { body: toMemoryCreateParams(memory as MemoryCreateInput) },\n options\n );\n const result = unwrapResults(response);\n if (isSnapshotResult(result)) {\n return (result.snapshot ?? result) as SnapshotEnvelopeOutput;\n }\n return extractID(result);\n }\n\n /**\n * Bulk parallel version of storeMemory with a concurrency cap.\n *\n * Default 8 concurrent in-flight requests matches the Python DX's\n * `asyncio.Semaphore(max_concurrency)` pattern. Use `maxConcurrency: 1`\n * for strictly serial submission; higher values risk overwhelming the\n * server when memories[] is large.\n */\n async storeMemories(\n memories: MemoryInput[],\n options?: { signal?: AbortSignal; maxConcurrency?: number }\n ): Promise<(string | SnapshotEnvelopeOutput)[]> {\n const cap = Math.max(1, options?.maxConcurrency ?? 8);\n const signal = options?.signal;\n const results: (string | SnapshotEnvelopeOutput)[] = new Array(memories.length);\n let nextIndex = 0;\n const worker = async (): Promise<void> => {\n while (true) {\n const i = nextIndex++;\n if (i >= memories.length) return;\n results[i] = await this.storeMemory(memories[i], { signal });\n }\n };\n await Promise.all(\n Array.from({ length: Math.min(cap, memories.length) }, () => worker())\n );\n return results;\n }\n\n /**\n * List memories scoped to one or more collection ids (string | string[])\n * or a full MemoryListParams object.\n */\n async listMemories(\n query: string | string[] | Record<string, unknown>,\n options?: { signal?: AbortSignal }\n ): Promise<unknown> {\n const normalized: Record<string, unknown> =\n typeof query === \"string\" || Array.isArray(query)\n ? { collectionIds: arrayify(query) }\n : query;\n return unwrap(this.memories.list(normalized as never, options));\n }\n\n /**\n * Memory search shortcut: unwraps `results`. (Affinity-header injection\n * is a planned enhancement; currently delegates straight to the resource.)\n */\n async search(\n body: Schemas[\"MemorySearchRequest\"],\n options?: { signal?: AbortSignal }\n ): Promise<unknown> {\n return unwrap(this.memories.search({ body }, options));\n }\n\n /**\n * deleteCollection coerces the wire {success: bool} envelope into a Python-\n * style boolean return.\n */\n async deleteCollection(id: string, options?: { signal?: AbortSignal }): Promise<boolean> {\n const response = await this.collections.delete(id, options);\n const result = unwrapResults(response);\n return Boolean((result as { success?: boolean }).success);\n }\n\n // Legacy aliases — \"cluster\" was the old name for \"collection\".\n // Bound to inherited (generated) collection methods.\n createCluster = this.createCollection;\n getCluster = this.getCollection;\n getClusterByName = this.getCollectionByName;\n listClusters = this.listCollections;\n updateCluster = this.updateCollection;\n deleteCluster = this.deleteCollection;\n\n /**\n * Positional `connectProvider(provider, collectionID, config?)` — wraps the\n * generated `connectors.connect({provider, body})` to build the body shape.\n */\n async connectProvider(\n provider: string,\n collectionID: string,\n config?: Record<string, unknown>,\n options?: { signal?: AbortSignal }\n ): Promise<unknown> {\n const body: Schemas[\"ConnectRequest\"] = {\n collection_id: collectionID,\n ...(config !== undefined ? { config } : {}),\n } as Schemas[\"ConnectRequest\"];\n return unwrap(this.connectors.connect({ provider, body }, options));\n }\n\n /** Positional listConnections(collectionID) — wraps the query wrapper. */\n async listConnections(\n collectionID: string,\n options?: { signal?: AbortSignal }\n ): Promise<unknown> {\n return unwrap(\n this.connectors.list({ collectionId: collectionID } as never, options)\n );\n }\n\n /** Positional disconnect(connectionID, deleteMemories?). */\n async disconnectConnection(\n connectionID: string,\n deleteMemories = false,\n options?: { signal?: AbortSignal }\n ): Promise<unknown> {\n return unwrap(\n this.connectors.disconnect(\n { connectionId: connectionID, deleteMemories } as never,\n options\n )\n );\n }\n\n /** Alias for disconnectConnection (same arg shape). */\n async disconnect(\n connectionID: string,\n deleteMemories = false,\n options?: { signal?: AbortSignal }\n ): Promise<unknown> {\n return unwrap(\n this.connectors.disconnect(\n { connectionId: connectionID, deleteMemories } as never,\n options\n )\n );\n }\n\n /** Single-id delete; coerces 204 to boolean true. */\n async deleteMemory(memoryID: string, options?: { signal?: AbortSignal }): Promise<boolean> {\n await this.memories.delete(memoryID, options);\n return true;\n }\n\n /** Bulk delete by ids. */\n async deleteMemories(\n memoryIDs: string[],\n options?: { signal?: AbortSignal }\n ): Promise<unknown> {\n return this.memories.deleteMany({ body: memoryIDs }, options);\n }\n\n /**\n * Polymorphic delete: dispatches based on argument type.\n * - `delete(\"/some/path\")` -> raw HTTP DELETE (escape hatch; not implemented)\n * - `delete(\"memory-id\")` -> deleteMemory\n * - `delete([\"id1\", \"id2\"])` -> deleteMemories (bulk)\n */\n async delete(\n pathOrMemoryIDs: RequestPath | string | string[],\n options?: { signal?: AbortSignal }\n ): Promise<unknown> {\n if (Array.isArray(pathOrMemoryIDs)) {\n return this.deleteMemories(pathOrMemoryIDs, options);\n }\n if (isRequestPath(pathOrMemoryIDs)) {\n throw new Error(\n `delete(\"${pathOrMemoryIDs}\") raw-path escape hatch is not implemented in this SDK yet`\n );\n }\n return this.deleteMemory(pathOrMemoryIDs, options);\n }\n}\n\n// ---------- helpers ----------\n\nfunction normalizeAuthOptions(options: ClientOptions): ClientOptions {\n if (\n options.apiKey != null &&\n options.bearerToken == null &&\n !looksLikeNebulaAPIKey(options.apiKey)\n ) {\n return { ...options, apiKey: undefined, bearerToken: options.apiKey };\n }\n return options;\n}\n\nfunction normalizeClientOptions(options: CompatClientOptions): ClientOptions {\n const {\n api_key: apiKeyAlias,\n apiKey,\n baseUrl: baseUrlAlias,\n baseURL: baseURLCapAlias,\n base_url: baseUrlSnakeAlias,\n timeout: timeoutAlias,\n bearerToken,\n bearer_token: bearerTokenAlias,\n accessToken,\n access_token: accessTokenAlias,\n ...rest\n } = options;\n const restClientOptions: ClientOptions = rest;\n return {\n ...restClientOptions,\n apiKey: firstDefined(apiKey, apiKeyAlias) ?? undefined,\n bearerToken:\n firstDefined(bearerToken, bearerTokenAlias, accessToken, accessTokenAlias) ?? undefined,\n baseUrl:\n firstDefined(\n restClientOptions.baseUrl,\n baseUrlAlias,\n baseURLCapAlias,\n baseUrlSnakeAlias\n ) ?? undefined,\n timeoutMs:\n firstDefined(restClientOptions.timeoutMs, timeoutAlias) ?? undefined,\n };\n}\n\nfunction firstDefined<T>(...values: (T | null | undefined)[]): T | null | undefined {\n return values.find((value) => value !== undefined);\n}\n\nexport function looksLikeNebulaAPIKey(token: string): boolean {\n const parts = token.split(\".\");\n if (parts.length !== 2) return false;\n const [publicPart, rawPart] = parts;\n return Boolean(rawPart) && (publicPart.startsWith(\"key_\") || publicPart.startsWith(\"neb_\"));\n}\n\nfunction toMemoryCreateParams(memory: MemoryCreateInput): MemoryCreateBody {\n const collectionID = memory.collection_id ?? memory.collectionId ?? undefined;\n const { collectionId: _ignore, content, memory_id: _ignoreMemoryID, ...rest } = memory;\n const params: Record<string, unknown> = { ...rest };\n\n if (collectionID !== undefined) {\n params.collection_id = collectionID;\n }\n if (content != null) {\n if (typeof content === \"string\") {\n params.raw_text = content;\n } else {\n params.content_parts = content;\n }\n }\n if (params.messages != null && !params.engram_type) {\n params.engram_type = \"conversation\";\n }\n return params as MemoryCreateBody;\n}\n\nfunction toMemoryAppendParams(memory: MemoryAppendInput): MemoryAppendBody {\n const collectionID = memory.collection_id ?? memory.collectionId ?? undefined;\n if (!collectionID) {\n throw new Error(\"collection_id is required when appending to an existing memory\");\n }\n const params: Record<string, unknown> = { collection_id: collectionID };\n for (const key of [\"metadata\", \"ingestion_config\", \"ingestion_mode\", \"raw_text\", \"chunks\", \"messages\"] as const) {\n const value = memory[key as keyof MemoryAppendInput];\n if (value != null) params[key] = value;\n }\n const content = (memory as MemoryCommonInput).content;\n if (content != null) {\n if (typeof content === \"string\") {\n params.raw_text = content;\n } else if (Array.isArray(content) && content.every((item) => typeof item === \"string\")) {\n params.chunks = content;\n } else if (Array.isArray(content)) {\n params.messages = content;\n }\n }\n return params as MemoryAppendBody;\n}\n\nfunction unwrap<T>(promise: PromiseLike<T>): Promise<ResultsOf<T>> {\n return Promise.resolve(promise).then((response) => unwrapResults(response) as ResultsOf<T>);\n}\n\nfunction unwrapResults<T>(response: T): unknown {\n if (response !== null && typeof response === \"object\" && \"results\" in response) {\n return (response as { results: unknown }).results;\n }\n return response;\n}\n\nfunction extractID(value: unknown): string {\n if (typeof value === \"object\" && value !== null) {\n const record = value as Record<string, unknown>;\n const id =\n record[\"id\"] ?? record[\"memory_id\"] ?? record[\"engram_id\"] ?? record[\"ephemeral_collection_id\"];\n if (typeof id === \"string\") return id;\n }\n throw new Error(\"Nebula memory create response did not include an id\");\n}\n\nfunction isSnapshotResult(value: unknown): value is { snapshot?: SnapshotEnvelopeOutput } {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"snapshot\" in (value as Record<string, unknown>)\n );\n}\n\nfunction arrayify(value: string | string[]): string[] {\n return Array.isArray(value) ? value : [value];\n}\n\nfunction isRequestPath(value: string): boolean {\n return value.startsWith(\"/\") || /^https?:\\/\\//i.test(value);\n}\n"],"mappings":";;;;;AAAA,IAAa,cAAb,cAAiC,MAAM;CACrC,OAAiC;CACjC,YAAY,SAAiB,SAA+B;EAC1D,MAAM,SAAS,OAAO;CACxB;AACF;AAEA,IAAa,wBAAb,cAA2C,YAAY;CACrD,OAAyB;AAC3B;AAEA,IAAa,qBAAb,cAAwC,YAAY;CAClD,OAAyB;AAC3B;AA6BA,SAAS,WAAW,MAAsC;CACxD,OACE,OAAO,SAAS,YAChB,SAAS,QACT,OAAQ,KAA4B,SAAS,YAC7C,OAAQ,KAA+B,YAAY;AAEvD;AAEA,IAAa,iBAAb,cAAoC,YAAY;CAC9C,OAAiC;CACjC;CACA;CACA;CAKA;CACA;CACA;CAEA,YAAY,SAA0B,SAAkB;EACtD,MAAM,WAAW,WAAW,QAAQ,IAAI,IAAI,QAAQ,OAAO,KAAA;EAC3D,MACE,WACE,UAAU,WACV,4BAA4B,QAAQ,OAAO,EAC/C;EACA,KAAK,SAAS,QAAQ;EAGtB,MAAM,UACJ,OAAO,UAAU,SAAS,WAAW,SAAS,OAAO,KAAA;EACvD,MAAM,SACJ,OAAO,UAAU,eAAe,WAC5B,SA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AoB;EAAkB;EAAY;EAAU;CAAU,GAAY;EAC/G,MAAM,QAAQ,OAAO;EACrB,IAAI,SAAS,MAAM,OAAO,OAAO;CACnC;CACA,MAAM,UAAW,OAA6B;CAC9C,IAAI,WAAW;MACT,OAAO,YAAY,UACrB,OAAO,WAAW;OACb,IAAI,MAAM,QAAQ,OAAO,KAAK,QAAQ,OAAO,SAAS,OAAO,SAAS,QAAQ,GACnF,OAAO,SAAS;OACX,IAAI,MAAM,QAAQ,OAAO,GAC9B,OAAO,WAAW;CAAA;CAGtB,OAAO;AACT;AAEA,SAAS,OAAU,SAAgD;CACjE,OAAO,QAAQ,QAAQ,OAAO,EAAE,MAAM,aAAa,cAAc,QAAQ,CAAiB;AAC5F;AAEA,SAAS,cAAiB,UAAsB;CAC9C,IAAI,aAAa,QAAQ,OAAO,aAAa,YAAY,aAAa,UACpE,OAAQ,SAAkC;CAE5C,OAAO;AACT;AAEA,SAAS,UAAU,OAAwB;CACzC,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM;EAC/C,MAAM,SAAS;EACf,MAAM,KACJ,OAAO,SAAS,OAAO,gBAAgB,OAAO,gBAAgB,OAAO;EACvE,IAAI,OAAO,OAAO,UAAU,OAAO;CACrC;CACA,MAAM,IAAI,MAAM,qDAAqD;AACvE;AAEA,SAAS,iBAAiB,OAAgE;CACxF,OACE,OAAO,UAAU,YACjB,UAAU,QACV,cAAe;AAEnB;AAEA,SAAS,SAAS,OAAoC;CACpD,OAAO,MAAM,QAAQ,KAAK,IAAI,QAAQ,CAAC,KAAK;AAC9C;AAEA,SAAS,cAAc,OAAwB;CAC7C,OAAO,MAAM,WAAW,GAAG,KAAK,gBAAgB,KAAK,KAAK;AAC5D"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../src/runtime/errors.ts","../src/runtime/retry.ts","../src/runtime/client.ts","../src/resources/client.ts","../src/resources/collections.ts","../src/resources/connectors.ts","../src/resources/memories.ts","../src/resources/snapshots.ts","../src/client.ts","../src/lib/dx.ts"],"sourcesContent":["export class NebulaError extends Error {\n override readonly name: string = \"NebulaError\";\n constructor(message: string, options?: { cause?: unknown }) {\n super(message, options);\n }\n}\n\nexport class NebulaConnectionError extends NebulaError {\n override readonly name = \"NebulaConnectionError\";\n}\n\nexport class NebulaTimeoutError extends NebulaError {\n override readonly name = \"NebulaTimeoutError\";\n}\n\n// Canonical Error envelope returned by every Nebula 4xx/5xx. The runtime\n// pulls these fields out of the response body and surfaces them as typed\n// accessors on NebulaAPIError so callers can branch on err.code without\n// digging into err.body.\n//\n// The optional fields are typed as `T | null` because the wire schema is\n// `anyOf [T, null]` — the server emits the keys with explicit `null` rather\n// than omitting them. The NebulaAPIError constructor coerces `null` to\n// `undefined` so the public accessor surface stays `T | undefined`.\nexport interface ErrorEnvelope {\n readonly type: string;\n readonly message: string;\n readonly code?: string | null;\n readonly request_id?: string | null;\n // `details` is intentionally `unknown`: the server emits arbitrary\n // JSON here. For validation errors it's an array of {loc, msg, type}\n // entries; for other classes it can be an object or null. Callers\n // should narrow at the read site (e.g. `Array.isArray(err.details)`).\n readonly details?: unknown;\n}\n\nexport interface APIErrorPayload {\n readonly status: number;\n readonly requestId?: string;\n readonly body: unknown;\n}\n\nfunction isEnvelope(body: unknown): body is ErrorEnvelope {\n return (\n typeof body === \"object\" &&\n body !== null &&\n typeof (body as { type?: unknown }).type === \"string\" &&\n typeof (body as { message?: unknown }).message === \"string\"\n );\n}\n\nexport class NebulaAPIError extends NebulaError {\n override readonly name: string = \"NebulaAPIError\";\n readonly status: number;\n readonly requestId?: string;\n readonly body: unknown;\n // Canonical envelope fields. `type` is always present when the server\n // returned the documented envelope; the rest are present when the server\n // populated them. All four are undefined when the response body wasn't\n // an envelope (e.g. an HTML error page from a misconfigured proxy).\n readonly type?: string;\n readonly code?: string;\n readonly details?: unknown;\n\n constructor(payload: APIErrorPayload, message?: string) {\n const envelope = isEnvelope(payload.body) ? payload.body : undefined;\n super(\n message ??\n envelope?.message ??\n `Nebula API error (status ${payload.status})`\n );\n this.status = payload.status;\n // Coerce `null` (wire-level) to `undefined` (idiomatic JS absence) so\n // every accessor's runtime value matches its declared T | undefined.\n const envCode =\n typeof envelope?.code === \"string\" ? envelope.code : undefined;\n const envRid =\n typeof envelope?.request_id === \"string\"\n ? envelope.request_id\n : undefined;\n // Prefer the envelope's request_id (server-stamped) over the header\n // we captured at the transport — they should match, but if they\n // diverge the envelope is authoritative.\n this.requestId = envRid ?? payload.requestId;\n this.body = payload.body;\n this.type = envelope?.type;\n this.code = envCode;\n this.details = envelope?.details ?? undefined;\n }\n}\n\nexport class NebulaBadRequestError extends NebulaAPIError {\n override readonly name = \"NebulaBadRequestError\";\n}\nexport class NebulaUnauthorizedError extends NebulaAPIError {\n override readonly name = \"NebulaUnauthorizedError\";\n}\nexport class NebulaForbiddenError extends NebulaAPIError {\n override readonly name = \"NebulaForbiddenError\";\n}\nexport class NebulaNotFoundError extends NebulaAPIError {\n override readonly name = \"NebulaNotFoundError\";\n}\nexport class NebulaConflictError extends NebulaAPIError {\n override readonly name = \"NebulaConflictError\";\n}\nexport class NebulaValidationError extends NebulaAPIError {\n override readonly name = \"NebulaValidationError\";\n}\nexport class NebulaRateLimitError extends NebulaAPIError {\n override readonly name = \"NebulaRateLimitError\";\n readonly retryAfter?: number;\n constructor(payload: APIErrorPayload, retryAfter?: number) {\n super(payload);\n this.retryAfter = retryAfter;\n }\n}\nexport class NebulaServerError extends NebulaAPIError {\n override readonly name = \"NebulaServerError\";\n}\n\ntype APIErrorCtor = new (payload: APIErrorPayload) => NebulaAPIError;\n\nconst STATUS_TO_CLASS: Record<number, APIErrorCtor> = {\n 400: NebulaBadRequestError,\n 401: NebulaUnauthorizedError,\n 403: NebulaForbiddenError,\n 404: NebulaNotFoundError,\n 409: NebulaConflictError,\n 422: NebulaValidationError,\n};\n\nexport function errorFromResponse(payload: APIErrorPayload, retryAfter?: number): NebulaAPIError {\n if (payload.status === 429) return new NebulaRateLimitError(payload, retryAfter);\n const cls = STATUS_TO_CLASS[payload.status];\n if (cls) return new cls(payload);\n if (payload.status >= 500) return new NebulaServerError(payload);\n return new NebulaAPIError(payload);\n}\n","export interface RetryPolicy {\n readonly maxRetries: number;\n readonly baseMs: number;\n readonly maxMs: number;\n}\n\nexport const DEFAULT_RETRY: RetryPolicy = {\n maxRetries: 2,\n baseMs: 250,\n maxMs: 8000,\n};\n\nconst RETRYABLE_STATUSES: ReadonlySet<number> = new Set([408, 429, 502, 503, 504]);\n\nexport function isRetryableStatus(status: number): boolean {\n return RETRYABLE_STATUSES.has(status);\n}\n\nexport function backoffMs(attempt: number, policy: RetryPolicy, retryAfterSec?: number): number {\n if (retryAfterSec != null && Number.isFinite(retryAfterSec)) {\n return Math.min(retryAfterSec * 1000, policy.maxMs);\n }\n const exp = Math.min(policy.baseMs * 2 ** attempt, policy.maxMs);\n return Math.floor(Math.random() * exp);\n}\n\nexport function sleep(ms: number, signal?: AbortSignal): Promise<void> {\n if (ms <= 0) return Promise.resolve();\n return new Promise((resolveSleep, reject) => {\n const handle = setTimeout(resolveSleep, ms);\n if (signal) {\n const onAbort = () => {\n clearTimeout(handle);\n reject(signal.reason ?? new Error(\"aborted\"));\n };\n if (signal.aborted) onAbort();\n else signal.addEventListener(\"abort\", onAbort, { once: true });\n }\n });\n}\n","import {\n errorFromResponse,\n NebulaAPIError,\n NebulaConnectionError,\n NebulaTimeoutError,\n} from \"./errors.ts\";\nimport { backoffMs, DEFAULT_RETRY, isRetryableStatus, sleep, type RetryPolicy } from \"./retry.ts\";\n\nexport interface ClientOptions {\n baseUrl?: string;\n apiKey?: string;\n bearerToken?: string;\n defaultHeaders?: Record<string, string>;\n fetchImpl?: typeof fetch;\n // Caller-supplied RequestInit fields applied to every outbound fetch.\n // Lets browser callers pass `credentials: \"include\"` for cookie auth,\n // or `mode`/`cache`/`referrer` for cross-origin tuning. Method, headers,\n // body, and signal are owned by the runtime and cannot be overridden\n // here (they're set per-request).\n fetchOptions?: Omit<RequestInit, \"method\" | \"headers\" | \"body\" | \"signal\">;\n timeoutMs?: number;\n retry?: Partial<RetryPolicy>;\n userAgent?: string;\n}\n\nexport interface RequestArgs {\n method: \"GET\" | \"POST\" | \"PUT\" | \"PATCH\" | \"DELETE\";\n path: string;\n pathParams?: Record<string, string | number>;\n query?: Record<string, unknown>;\n body?: unknown;\n headers?: Record<string, string>;\n idempotent?: boolean;\n signal?: AbortSignal;\n}\n\nconst DEFAULT_BASE_URL = \"https://api.zeroset.com\";\nconst DEFAULT_TIMEOUT_MS = 60_000;\n\nexport class NebulaCore {\n readonly baseUrl: string;\n readonly apiKey?: string;\n readonly bearerToken?: string;\n readonly defaultHeaders: Record<string, string>;\n readonly fetchImpl: typeof fetch;\n readonly fetchOptions: Omit<RequestInit, \"method\" | \"headers\" | \"body\" | \"signal\">;\n readonly timeoutMs: number;\n readonly retry: RetryPolicy;\n readonly userAgent: string;\n\n constructor(options: ClientOptions = {}) {\n this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/$/, \"\");\n this.apiKey = options.apiKey;\n this.bearerToken = options.bearerToken;\n // Filter null/undefined values. Callers (often using `as any` to\n // bypass the `Record<string, string>` type) pass nulls to suppress\n // a header — but `new Headers({k: null})` coerces null to the\n // literal string \"null\", which a backend that checks \"is this\n // header present\" treats as an explicit credential. Strip nulls\n // here so the Headers constructor sees only real string values.\n this.defaultHeaders = filterNullishHeaders(options.defaultHeaders);\n this.fetchImpl = options.fetchImpl ?? globalThis.fetch.bind(globalThis);\n this.fetchOptions = options.fetchOptions ?? {};\n this.timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;\n this.retry = { ...DEFAULT_RETRY, ...(options.retry ?? {}) };\n this.userAgent = options.userAgent ?? \"nebula-sdk-js/0.0.1\";\n }\n\n buildUrl(path: string, pathParams?: Record<string, string | number>, query?: Record<string, unknown>): string {\n let resolved = path;\n if (pathParams) {\n for (const [k, v] of Object.entries(pathParams)) {\n resolved = resolved.replace(`{${k}}`, encodeURIComponent(String(v)));\n }\n }\n const url = new URL(this.baseUrl + resolved);\n if (query) {\n for (const [k, v] of Object.entries(query)) {\n if (v === undefined || v === null) continue;\n if (Array.isArray(v)) for (const item of v) url.searchParams.append(k, String(item));\n else url.searchParams.set(k, String(v));\n }\n }\n return url.toString();\n }\n\n private buildHeaders(perRequest?: Record<string, string>, hasBody = false): Headers {\n const headers = new Headers(this.defaultHeaders);\n headers.set(\"User-Agent\", this.userAgent);\n headers.set(\"Accept\", \"application/json\");\n if (hasBody) headers.set(\"Content-Type\", \"application/json\");\n if (this.apiKey) headers.set(\"X-API-Key\", this.apiKey);\n if (this.bearerToken) headers.set(\"Authorization\", `Bearer ${this.bearerToken}`);\n if (perRequest) {\n for (const [k, v] of Object.entries(perRequest)) headers.set(k, v);\n }\n return headers;\n }\n\n async request<T>(args: RequestArgs): Promise<T> {\n const url = this.buildUrl(args.path, args.pathParams, args.query);\n const hasBody = args.body !== undefined && args.body !== null;\n const headers = this.buildHeaders(args.headers, hasBody);\n // Spread caller-supplied fetch options first so the runtime-owned\n // method/headers/body always win on key collision. The TS type for\n // `fetchOptions` already excludes those keys, so this is belt-and-\n // suspenders.\n const init: RequestInit = {\n ...this.fetchOptions,\n method: args.method,\n headers,\n body: hasBody ? JSON.stringify(args.body) : undefined,\n };\n\n const maxAttempts = (args.idempotent ?? false) ? this.retry.maxRetries + 1 : 1;\n let lastError: unknown;\n for (let attempt = 0; attempt < maxAttempts; attempt++) {\n const controller = new AbortController();\n const timeoutHandle = setTimeout(() => controller.abort(new Error(\"timeout\")), this.timeoutMs);\n const { signal: composedSignal, dispose: disposeAbort } = composeAbort(\n controller.signal,\n args.signal\n );\n try {\n const response = await this.fetchImpl(url, { ...init, signal: composedSignal });\n\n if (response.ok) {\n if (response.status === 204) return undefined as T;\n return (await response.json()) as T;\n }\n\n const text = await safeReadText(response);\n const parsed = safeParseJSON(text);\n const retryAfter = parseRetryAfter(response.headers.get(\"Retry-After\"));\n const err = errorFromResponse(\n {\n status: response.status,\n requestId: response.headers.get(\"X-Request-Id\") ?? undefined,\n body: parsed ?? text,\n },\n retryAfter\n );\n\n if (isRetryableStatus(response.status) && attempt + 1 < maxAttempts) {\n await sleep(backoffMs(attempt, this.retry, retryAfter), args.signal);\n lastError = err;\n continue;\n }\n throw err;\n } catch (rawError) {\n if (rawError instanceof Error && rawError.name === \"AbortError\") {\n if (args.signal?.aborted) throw rawError;\n throw new NebulaTimeoutError(`Request timed out after ${this.timeoutMs}ms`, { cause: rawError });\n }\n if (rawError instanceof NebulaAPIError || rawError instanceof NebulaConnectionError) {\n throw rawError;\n }\n if (attempt + 1 < maxAttempts) {\n await sleep(backoffMs(attempt, this.retry), args.signal);\n lastError = rawError;\n continue;\n }\n if (rawError instanceof Error) {\n throw new NebulaConnectionError(rawError.message, { cause: rawError });\n }\n throw rawError;\n } finally {\n clearTimeout(timeoutHandle);\n disposeAbort();\n }\n }\n throw lastError ?? new NebulaConnectionError(\"retry budget exhausted\");\n }\n}\n\nfunction composeAbort(\n timeoutSignal: AbortSignal,\n userSignal?: AbortSignal\n): { signal: AbortSignal; dispose: () => void } {\n if (!userSignal) return { signal: timeoutSignal, dispose: () => {} };\n const controller = new AbortController();\n // Hold one listener per source so dispose can detach exactly what we added.\n // Caller's signal can outlive the request (e.g. a long-lived request-scope\n // controller reused across many SDK calls); without dispose, each call's\n // closures would stay pinned on it until that signal eventually aborts.\n const onTimeoutAbort = () =>\n controller.abort(timeoutSignal.reason ?? new Error(\"aborted\"));\n const onUserAbort = () =>\n controller.abort(userSignal.reason ?? new Error(\"aborted\"));\n if (timeoutSignal.aborted) controller.abort(timeoutSignal.reason);\n if (userSignal.aborted) controller.abort(userSignal.reason);\n timeoutSignal.addEventListener(\"abort\", onTimeoutAbort, { once: true });\n userSignal.addEventListener(\"abort\", onUserAbort, { once: true });\n const dispose = () => {\n timeoutSignal.removeEventListener(\"abort\", onTimeoutAbort);\n userSignal.removeEventListener(\"abort\", onUserAbort);\n };\n return { signal: controller.signal, dispose };\n}\n\nasync function safeReadText(response: Response): Promise<string> {\n try {\n return await response.text();\n } catch {\n return \"\";\n }\n}\n\nfunction safeParseJSON(text: string): unknown {\n if (!text) return undefined;\n try {\n return JSON.parse(text);\n } catch {\n return undefined;\n }\n}\n\nfunction filterNullishHeaders(\n headers: Record<string, string> | undefined\n): Record<string, string> {\n if (!headers) return {};\n const out: Record<string, string> = {};\n for (const [k, v] of Object.entries(headers)) {\n // Accept anything that survives the truthy guard; the type is\n // `Record<string, string>` but callers occasionally cast with\n // `as any` to slip nulls through.\n if (v !== null && v !== undefined) out[k] = v;\n }\n return out;\n}\n\nfunction parseRetryAfter(header: string | null): number | undefined {\n if (!header) return undefined;\n const asNumber = Number.parseFloat(header);\n if (Number.isFinite(asNumber)) return asNumber;\n const asDate = Date.parse(header);\n if (Number.isFinite(asDate)) return Math.max(0, (asDate - Date.now()) / 1000);\n return undefined;\n}\n","// AUTOGENERATED by nebula-sdks/generator. Do not edit by hand.\n// Source: nebula-sdks/openapi/openapi.json\n\nimport type { components } from \"../types.ts\";\nimport type { NebulaCore } from \"../runtime/client.ts\";\n\nexport interface RequestOptions {\n signal?: AbortSignal;\n}\n\nexport class ClientResource {\n constructor(private readonly core: NebulaCore) {}\n\n /**\n *\n * Health probe\n * \n * Lightweight liveness probe. Returns a 200 with a fixed message when the API process is up. Does not verify downstream dependencies (database, storage, workers) — use the internal status endpoints for those.\n * @operationId client.health\n * @endpoint GET /v1/health\n */\n async health(options?: RequestOptions): Promise<components[\"schemas\"][\"GenericMessageResponse\"]> {\n const response = (await this.core.request<components[\"schemas\"][\"WrappedGenericMessageResponse\"]>({\n method: \"GET\",\n path: \"/v1/health\",\n pathParams: {},\n query: undefined,\n idempotent: true,\n signal: options?.signal,\n })) as { results: components[\"schemas\"][\"GenericMessageResponse\"] };\n return response.results;\n }\n\n}","// AUTOGENERATED by nebula-sdks/generator. Do not edit by hand.\n// Source: nebula-sdks/openapi/openapi.json\n\nimport type { components } from \"../types.ts\";\nimport type { NebulaCore } from \"../runtime/client.ts\";\n\nexport interface RequestOptions {\n signal?: AbortSignal;\n}\n\nexport class CollectionsResource {\n constructor(private readonly core: NebulaCore) {}\n\n /**\n *\n * Create a new collection\n * \n * Create a new collection and automatically add the creating user\n * to it.\n * \n * This endpoint allows authenticated users to create a new collection\n * with a specified name and optional description. The user creating\n * the collection is automatically added as a member.\n * @operationId collections.create\n * @endpoint POST /v1/collections\n */\n async create(\n body: components[\"schemas\"][\"CreateCollectionRequest\"],\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"CollectionResponse\"]> {\n const response = (await this.core.request<components[\"schemas\"][\"WrappedCollectionResponse\"]>({\n method: \"POST\",\n path: \"/v1/collections\",\n pathParams: {},\n query: undefined,\n body: body,\n idempotent: false,\n signal: options?.signal,\n })) as { results: components[\"schemas\"][\"CollectionResponse\"] };\n return response.results;\n }\n\n /**\n *\n * Delete collection\n * \n * Delete an existing collection.\n * \n * This endpoint allows deletion of a collection identified by its\n * UUID. The user must have appropriate permissions to delete the\n * collection. Deleting a collection removes all associations but does\n * not delete the engrams within it.\n * @operationId collections.delete\n * @endpoint DELETE /v1/collections/{id}\n */\n async delete(\n id: string,\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"GenericBooleanResponse\"]> {\n const response = (await this.core.request<components[\"schemas\"][\"WrappedGenericBooleanResponse\"]>({\n method: \"DELETE\",\n path: \"/v1/collections/{id}\",\n pathParams: { id: id },\n query: undefined,\n idempotent: true,\n signal: options?.signal,\n })) as { results: components[\"schemas\"][\"GenericBooleanResponse\"] };\n return response.results;\n }\n\n /**\n *\n * List collections\n * \n * Returns a cursor-paginated list of collections the authenticated\n * user has access to.\n * \n * Results can be filtered by providing specific collection IDs.\n * Regular users will only see collections they own or have access to.\n * Superusers can see all collections.\n * \n * The collections are returned in order of last modification, with\n * most recent first.\n * @operationId collections.list\n * @endpoint GET /v1/collections\n */\n async list(\n params: {\n /** A list of collection IDs to retrieve. If not provided, all collections will be returned. */\n ids?: Array<string>;\n /** Filter collections by name (case-insensitive exact match). */\n name?: string | null;\n /** Opaque pagination cursor. Pass the ``next_cursor`` from a previous response to fetch the next page. */\n cursor?: string | null;\n /** Specifies a limit on the number of objects to return, ranging between 1 and 1000. Defaults to 100. */\n limit?: number;\n /** If true, only returns collections owned by the user, not all accessible collections. */\n ownerOnly?: boolean;\n /** Filter by workspace ID. Pass a UUID to scope to a workspace, or omit for all. */\n workspaceId?: string | null;\n} = {},\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"PaginatedCollectionResponse\"]> {\n return this.core.request<components[\"schemas\"][\"PaginatedCollectionResponse\"]>({\n method: \"GET\",\n path: \"/v1/collections\",\n pathParams: {},\n query: { ids: params.ids, name: params.name, cursor: params.cursor, limit: params.limit, owner_only: params.ownerOnly, workspace_id: params.workspaceId },\n idempotent: true,\n signal: options?.signal,\n });\n }\n\n /**\n *\n * Get collection details\n * \n * Get details of a specific collection.\n * \n * This endpoint retrieves detailed information about a single\n * collection identified by its UUID. The user must have access to the\n * collection to view its details.\n * @operationId collections.retrieve\n * @endpoint GET /v1/collections/{id}\n */\n async retrieve(\n id: string,\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"CollectionResponse\"]> {\n const response = (await this.core.request<components[\"schemas\"][\"WrappedCollectionResponse\"]>({\n method: \"GET\",\n path: \"/v1/collections/{id}\",\n pathParams: { id: id },\n query: undefined,\n idempotent: true,\n signal: options?.signal,\n })) as { results: components[\"schemas\"][\"CollectionResponse\"] };\n return response.results;\n }\n\n /**\n *\n * Get a collection by name\n * \n * Retrieve a collection by its (owner_id, name) combination.\n * \n * The authenticated user can only fetch collections they own, or, if\n * superuser, from anyone.\n * @operationId collections.retrieveByName\n * @endpoint GET /v1/collections/name/{collection_name}\n */\n async retrieveByName(\n params: {\n /** The name of the collection */\n collectionName: string;\n /** (Superuser only) Specify the owner_id to retrieve a collection by name */\n ownerId?: string | null;\n},\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"CollectionResponse\"]> {\n const response = (await this.core.request<components[\"schemas\"][\"WrappedCollectionResponse\"]>({\n method: \"GET\",\n path: \"/v1/collections/name/{collection_name}\",\n pathParams: { collection_name: params.collectionName },\n query: { owner_id: params.ownerId },\n idempotent: true,\n signal: options?.signal,\n })) as { results: components[\"schemas\"][\"CollectionResponse\"] };\n return response.results;\n }\n\n /**\n *\n * Update collection\n * \n * Update an existing collection's configuration.\n * \n * This endpoint allows updating the name, description, and access settings of an\n * existing collection. The user must have appropriate permissions to\n * modify the collection.\n * @operationId collections.update\n * @endpoint POST /v1/collections/{id}\n */\n async update(\n params: {\n /** The unique identifier of the collection to update */\n id: string;\n body: components[\"schemas\"][\"UpdateCollectionRequest\"];\n},\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"CollectionResponse\"]> {\n const response = (await this.core.request<components[\"schemas\"][\"WrappedCollectionResponse\"]>({\n method: \"POST\",\n path: \"/v1/collections/{id}\",\n pathParams: { id: params.id },\n query: undefined,\n body: params.body,\n idempotent: false,\n signal: options?.signal,\n })) as { results: components[\"schemas\"][\"CollectionResponse\"] };\n return response.results;\n }\n\n}","// AUTOGENERATED by nebula-sdks/generator. Do not edit by hand.\n// Source: nebula-sdks/openapi/openapi.json\n\nimport type { components } from \"../types.ts\";\nimport type { NebulaCore } from \"../runtime/client.ts\";\n\nexport interface RequestOptions {\n signal?: AbortSignal;\n}\n\nexport class ConnectorsResource {\n constructor(private readonly core: NebulaCore) {}\n\n /**\n *\n * Start OAuth connection flow\n * \n * Start the OAuth connection flow for the given external provider. Returns the authorization URL the user should visit to grant Nebula access. After consent the provider redirects back to Nebula and the connection becomes active.\n * @operationId connectors.connect\n * @endpoint POST /v1/connectors/{provider}/connect\n */\n async connect(\n params: {\n provider: string;\n body: components[\"schemas\"][\"ConnectRequest\"];\n},\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"ConnectorConnectResponse\"]> {\n const response = (await this.core.request<components[\"schemas\"][\"WrappedConnectorConnectResponse\"]>({\n method: \"POST\",\n path: \"/v1/connectors/{provider}/connect\",\n pathParams: { provider: params.provider },\n query: undefined,\n body: params.body,\n idempotent: false,\n signal: options?.signal,\n })) as { results: components[\"schemas\"][\"ConnectorConnectResponse\"] };\n return response.results;\n }\n\n /**\n *\n * Disconnect an external data source\n * \n * Disconnect the named connection, revoking the stored OAuth credentials and stopping future syncs. Optionally pass `delete_memories=true` to also remove every memory this connection had ingested.\n * @operationId connectors.disconnect\n * @endpoint DELETE /v1/connectors/{connection_id}\n */\n async disconnect(\n params: {\n connectionId: string;\n deleteMemories?: boolean;\n},\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"ConnectorDisconnectResponse\"]> {\n const response = (await this.core.request<components[\"schemas\"][\"WrappedConnectorDisconnectResponse\"]>({\n method: \"DELETE\",\n path: \"/v1/connectors/{connection_id}\",\n pathParams: { connection_id: params.connectionId },\n query: { delete_memories: params.deleteMemories },\n idempotent: true,\n signal: options?.signal,\n })) as { results: components[\"schemas\"][\"ConnectorDisconnectResponse\"] };\n return response.results;\n }\n\n /**\n *\n * List active connections for a collection\n * \n * Return every connector connection associated with the given collection, with encrypted credentials redacted. Useful for showing the user which third-party data sources are wired up to a collection.\n * @operationId connectors.list\n * @endpoint GET /v1/connectors\n */\n async list(\n params: {\n collectionId: string;\n},\n options?: RequestOptions,\n ): Promise<Array<components[\"schemas\"][\"ConnectorConnectionResponse\"]>> {\n const response = (await this.core.request<components[\"schemas\"][\"WrappedListOfConnectorConnectionResponse\"]>({\n method: \"GET\",\n path: \"/v1/connectors\",\n pathParams: {},\n query: { collection_id: params.collectionId },\n idempotent: true,\n signal: options?.signal,\n })) as { results: Array<components[\"schemas\"][\"ConnectorConnectionResponse\"]> };\n return response.results;\n }\n\n /**\n *\n * List available connector providers\n * \n * Return the set of connector provider identifiers (e.g. `google_drive`, `slack`) that this Nebula instance is configured to expose. Pass one of these to `POST /connectors/{provider}/connect` to start an OAuth flow.\n * @operationId connectors.listProviders\n * @endpoint GET /v1/connectors/providers\n */\n async listProviders(options?: RequestOptions): Promise<Array<string>> {\n const response = (await this.core.request<components[\"schemas\"][\"WrappedListOfStr\"]>({\n method: \"GET\",\n path: \"/v1/connectors/providers\",\n pathParams: {},\n query: undefined,\n idempotent: true,\n signal: options?.signal,\n })) as { results: Array<string> };\n return response.results;\n }\n\n /**\n *\n * Get a single connection by ID\n * \n * Fetch a single connector connection by its UUID. Returns the connection metadata plus whether the underlying subscription is active. Encrypted credentials are never returned to clients.\n * @operationId connectors.retrieve\n * @endpoint GET /v1/connectors/{connection_id}\n */\n async retrieve(\n connectionId: string,\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"ConnectorConnectionResponse\"]> {\n const response = (await this.core.request<components[\"schemas\"][\"WrappedConnectorConnectionResponse\"]>({\n method: \"GET\",\n path: \"/v1/connectors/{connection_id}\",\n pathParams: { connection_id: connectionId },\n query: undefined,\n idempotent: true,\n signal: options?.signal,\n })) as { results: components[\"schemas\"][\"ConnectorConnectionResponse\"] };\n return response.results;\n }\n\n /**\n *\n * Manually trigger a sync\n * \n * Schedule an immediate sync for an active connection, bypassing the normal cadence. Returns 409 if a sync is already in progress and 400 if the connection isn't in the `active` state.\n * @operationId connectors.sync\n * @endpoint POST /v1/connectors/{connection_id}/sync\n */\n async sync(\n connectionId: string,\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"ConnectorSyncResponse\"]> {\n const response = (await this.core.request<components[\"schemas\"][\"WrappedConnectorSyncResponse\"]>({\n method: \"POST\",\n path: \"/v1/connectors/{connection_id}/sync\",\n pathParams: { connection_id: connectionId },\n query: undefined,\n idempotent: true,\n signal: options?.signal,\n })) as { results: components[\"schemas\"][\"ConnectorSyncResponse\"] };\n return response.results;\n }\n\n}","// AUTOGENERATED by nebula-sdks/generator. Do not edit by hand.\n// Source: nebula-sdks/openapi/openapi.json\n\nimport type { components } from \"../types.ts\";\nimport type { NebulaCore } from \"../runtime/client.ts\";\n\nexport interface RequestOptions {\n signal?: AbortSignal;\n}\n\nexport class MemoriesResource {\n constructor(private readonly core: NebulaCore) {}\n\n /**\n *\n * Append content to an engram\n * \n * Append content to an existing engram.\n * \n * **For conversation engrams:**\n * - Provide `messages` array with content, role, and optional metadata\n * - Works like `/conversations/{id}/messages` endpoint\n * \n * **For document engrams:**\n * - Provide either `raw_text` or `chunks` to append additional content\n * - Content will be processed and added to the engram\n * @operationId memories.append\n * @endpoint POST /v1/memories/{id}/append\n */\n async append(\n params: {\n /** The unique identifier of the engram */\n id: string;\n body: components[\"schemas\"][\"AppendMemoryRequest\"];\n},\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"AppendMemoryResponse\"] | components[\"schemas\"][\"IngestionResponse\"]> {\n const response = (await this.core.request<unknown>({\n method: \"POST\",\n path: \"/v1/memories/{id}/append\",\n pathParams: { id: params.id },\n query: undefined,\n body: params.body,\n idempotent: false,\n signal: options?.signal,\n })) as { results: components[\"schemas\"][\"AppendMemoryResponse\"] | components[\"schemas\"][\"IngestionResponse\"] };\n return response.results;\n }\n\n /**\n *\n * Create a new memory (conversation or document)\n * \n * Create a new memory (conversation or document) using clean JSON body.\n * \n * - Use `collection_id` (UUID)\n * - `kind` is optional and inferred from payload shape:\n * - If `messages` present -> conversation\n * - Otherwise -> document\n * - For conversations: provide `messages` array\n * - For documents: provide `raw_text` or `chunks`\n * - Use `snapshot` for device-memory mode (mutually exclusive with collection_id)\n * @operationId memories.create\n * @endpoint POST /v1/memories\n */\n async create(\n body: components[\"schemas\"][\"CreateMemoryRequest\"],\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"MemoryCreateAcceptedResponse\"] | components[\"schemas\"][\"SnapshotMutationResult\"]> {\n const response = (await this.core.request<components[\"schemas\"][\"MemoryCreateResponse\"]>({\n method: \"POST\",\n path: \"/v1/memories\",\n pathParams: {},\n query: undefined,\n body: body,\n idempotent: false,\n signal: options?.signal,\n })) as { results: components[\"schemas\"][\"MemoryCreateAcceptedResponse\"] | components[\"schemas\"][\"SnapshotMutationResult\"] };\n return response.results;\n }\n\n /**\n *\n * Get presigned URL for large file upload\n * \n * Get a presigned URL for uploading large files directly to S3.\n * \n * Use this for files larger than 5MB that cannot be sent inline as base64.\n * After uploading, reference the file in memory creation using S3FileReference.\n * \n * Args:\n * filename: Original filename (e.g., \"image.jpg\")\n * content_type: MIME type (e.g., \"image/jpeg\", \"application/pdf\")\n * file_size: Expected file size in bytes (max 100MB)\n * \n * Returns:\n * dict with:\n * - upload_url: Presigned URL for PUT request (expires in 1 hour)\n * - upload_headers: Headers that must be sent with the presigned PUT request\n * - s3_key: The S3 key to reference in memory creation\n * - bucket: S3 bucket name\n * - expires_in: Seconds until URL expires\n * - max_size: Maximum allowed file size\n * @operationId memories.createUpload\n * @endpoint POST /v1/memories/upload\n */\n async createUpload(\n params: {\n /** Original filename (e.g., 'image.jpg') */\n filename: string;\n /** MIME type (e.g., 'image/jpeg', 'application/pdf') */\n contentType: string;\n /** Expected file size in bytes (max 100MB) */\n fileSize: number;\n},\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"PresignedUploadResponse\"]> {\n const response = (await this.core.request<components[\"schemas\"][\"WrappedPresignedUploadResponse\"]>({\n method: \"POST\",\n path: \"/v1/memories/upload\",\n pathParams: {},\n query: { filename: params.filename, content_type: params.contentType, file_size: params.fileSize },\n idempotent: false,\n signal: options?.signal,\n })) as { results: components[\"schemas\"][\"PresignedUploadResponse\"] };\n return response.results;\n }\n\n /**\n *\n * Delete an engram\n * \n * Delete a specific engram with graph awareness. All chunks corresponding to the\n * engram are deleted, and graph components (entities/relationships) are updated\n * or deleted based on remaining chunk references from other engrams.\n * \n * This method now properly handles graph components and maintains graph integrity\n * for search operations.\n * @operationId memories.delete\n * @endpoint DELETE /v1/memories/{id}\n */\n async delete(\n id: string,\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"GenericBooleanResponse\"]> {\n const response = (await this.core.request<components[\"schemas\"][\"WrappedGenericBooleanResponse\"]>({\n method: \"DELETE\",\n path: \"/v1/memories/{id}\",\n pathParams: { id: id },\n query: undefined,\n idempotent: false,\n signal: options?.signal,\n })) as { results: components[\"schemas\"][\"GenericBooleanResponse\"] };\n return response.results;\n }\n\n /**\n *\n * Delete one or more engrams\n * \n * Delete one or more engrams.\n * \n * This endpoint efficiently handles both single and batch deletions.\n * When multiple IDs are provided, it uses optimized batch operations.\n * \n * Args:\n * ids: Either a single UUID or a list of UUIDs to delete\n * \n * Returns:\n * For single deletion: boolean success response\n * For batch deletion: detailed results with successful and failed deletions\n * @operationId memories.deleteMany\n * @endpoint POST /v1/memories/delete\n */\n async deleteMany(\n body: components[\"schemas\"][\"DeleteMemoriesRequest\"],\n options?: RequestOptions,\n ): Promise<unknown> {\n return this.core.request<unknown>({\n method: \"POST\",\n path: \"/v1/memories/delete\",\n pathParams: {},\n query: undefined,\n body: body,\n idempotent: false,\n signal: options?.signal,\n });\n }\n\n /**\n *\n * Delete a previously uploaded S3 file\n * \n * Delete a file from S3 that was uploaded via a presigned URL.\n * Verifies the caller owns the file via S3 object metadata.\n * @operationId memories.deleteUpload\n * @endpoint DELETE /v1/memories/upload\n */\n async deleteUpload(\n params: {\n /** S3 key of the file to delete (returned by POST /memories/upload) */\n s3Key: string;\n},\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"GenericMessageResponse\"]> {\n const response = (await this.core.request<components[\"schemas\"][\"WrappedGenericMessageResponse\"]>({\n method: \"DELETE\",\n path: \"/v1/memories/upload\",\n pathParams: {},\n query: { s3_key: params.s3Key },\n idempotent: true,\n signal: options?.signal,\n })) as { results: components[\"schemas\"][\"GenericMessageResponse\"] };\n return response.results;\n }\n\n /**\n *\n * List engrams\n * \n * Returns a cursor-paginated list of engrams the authenticated user\n * has access to.\n * \n * Results can be filtered by providing specific engram IDs or collection IDs.\n * Regular users will only see engrams they own or have access to through\n * collections. Superusers can see all engrams.\n * \n * The engrams are returned in order of creation time, most recent\n * first. The response includes the engram's text field if available.\n * @operationId memories.list\n * @endpoint GET /v1/memories\n */\n async list(\n params: {\n /** A list of engram IDs to retrieve. If not provided, all engrams will be returned. */\n ids?: Array<string>;\n /** Opaque pagination cursor. Pass the ``next_cursor`` from a previous response to fetch the next page. */\n cursor?: string | null;\n /** Specifies a limit on the number of objects to return, ranging between 1 and 1000. Defaults to 100. */\n limit?: number;\n /** Maximum chunks to inline per engram. Defaults to all chunks for backwards compatibility; pass 0 to skip chunk hydration. */\n chunksLimit?: number | null;\n /** If true, only returns engrams owned by the user, not all accessible engrams. */\n ownerOnly?: boolean;\n /** Optional list of collection IDs to filter engrams by. If provided, exactly one collection ID must be specified. */\n collectionIds?: Array<string> | null;\n /** JSON string for metadata filtering. Example: '{\"metadata.source\": {\"$eq\": \"playground\"}}' */\n metadataFilters?: string | null;\n /** Read-your-writes assertion: the WAL-tail overlay path waits for at least this seq to be applied before serving (or returns 503 Unavailable on timeout). REQUIRES exactly one collection_ids entry — without a collection scope the request returns 422 (the per-WAL-shard scalar applied_wal_seq is meaningless across collections). When the served shard has not been migrated to wal_compaction_enabled, the field is accepted but the served path is the legacy overlay (the assertion has no effect — the response's applied_wal_seq will be 0). Pass back the value the matching upload response surfaced. */\n minAppliedWalSeq?: number | null;\n} = {},\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"PaginatedListedEngram\"]> {\n return this.core.request<components[\"schemas\"][\"PaginatedListedEngram\"]>({\n method: \"GET\",\n path: \"/v1/memories\",\n pathParams: {},\n query: { ids: params.ids, cursor: params.cursor, limit: params.limit, chunks_limit: params.chunksLimit, owner_only: params.ownerOnly, collection_ids: params.collectionIds, metadata_filters: params.metadataFilters, min_applied_wal_seq: params.minAppliedWalSeq },\n idempotent: true,\n signal: options?.signal,\n });\n }\n\n /**\n *\n * Recall workflow patterns by intent\n * \n * Workflow-pattern recall over 5 intents.\n * \n * * ``cursor`` -- match the caller's anchor against pattern\n * canonical states, return ranked patterns + position.\n * * ``predict`` -- like cursor but include the predicted next\n * trace from each pattern's canonical instance.\n * * ``resume`` -- like cursor, biased toward longer patterns.\n * * ``evidence`` -- expand a specific pattern via\n * ``hydrate_pattern``.\n * * ``bootstrap`` -- top-K patterns by confidence with no anchor.\n * @operationId memories.recallWorkflow\n * @endpoint POST /v1/memories/workflow/recall\n */\n async recallWorkflow(\n body: components[\"schemas\"][\"CursorRecallRequest\"] | components[\"schemas\"][\"PredictRecallRequest\"] | components[\"schemas\"][\"ResumeRecallRequest\"] | components[\"schemas\"][\"EvidenceRecallRequest\"] | components[\"schemas\"][\"BootstrapRecallRequest\"],\n options?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n const response = (await this.core.request<components[\"schemas\"][\"WorkflowRecallResponse\"]>({\n method: \"POST\",\n path: \"/v1/memories/workflow/recall\",\n pathParams: {},\n query: undefined,\n body: body,\n idempotent: false,\n signal: options?.signal,\n })) as { results: Record<string, unknown> };\n return response.results;\n }\n\n /**\n *\n * Retrieve an engram\n * \n * Retrieves detailed information about a specific engram by its\n * ID.\n * \n * This endpoint returns the engram's metadata, status, and system information. It does not\n * return the engram's content - use the `/engrams/{id}/download` endpoint for that.\n * \n * Users can only retrieve engrams they own or have access to through collections.\n * Superusers can retrieve any engram.\n * @operationId memories.retrieve\n * @endpoint GET /v1/memories/{id}\n */\n async retrieve(\n id: string,\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"Engram\"]> {\n const response = (await this.core.request<components[\"schemas\"][\"WrappedEngram\"]>({\n method: \"GET\",\n path: \"/v1/memories/{id}\",\n pathParams: { id: id },\n query: undefined,\n idempotent: true,\n signal: options?.signal,\n })) as { results: components[\"schemas\"][\"Engram\"] };\n return response.results;\n }\n\n /**\n *\n * Search memories\n * \n * Perform a search query across your memories.\n * \n * **Standard mode** (collection_ids or readable-scope search): returns hierarchical MemoryRecall\n * with semantics, episodes, procedures, and sources.\n * \n * **Snapshot mode** (snapshot field): returns graph-search results with\n * {entities, relationships} from stateless in-memory traversal.\n * @operationId memories.search\n * @endpoint POST /v1/memories/search\n */\n async search(\n body: components[\"schemas\"][\"MemorySearchRequest\"],\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"CompactMemoryRecallResponse\"] | components[\"schemas\"][\"MemoryRecall\"] | components[\"schemas\"][\"SnapshotSearchResult\"]> {\n const response = (await this.core.request<unknown>({\n method: \"POST\",\n path: \"/v1/memories/search\",\n pathParams: {},\n query: undefined,\n body: body,\n idempotent: false,\n signal: options?.signal,\n })) as { results: components[\"schemas\"][\"CompactMemoryRecallResponse\"] | components[\"schemas\"][\"MemoryRecall\"] | components[\"schemas\"][\"SnapshotSearchResult\"] };\n return response.results;\n }\n\n /**\n *\n * Update a memory\n * \n * Update memory-level properties including name, metadata, and collection associations.\n * \n * This endpoint allows updating properties of an entire memory (document or conversation)\n * without modifying its content:\n * - **name**: Updates the authoritative engram title\n * - **metadata**: Can replace or merge with existing metadata\n * - **collection_ids**: Updates authoritative engram collection associations\n * \n * Users can only update memories they own or have access to through collections.\n * At least one collection association must be maintained.\n * \n * If collection_id is provided and the engram is shared across collections, a copy-on-write\n * will be performed to create a collection-specific copy before modification.\n * @operationId memories.update\n * @endpoint PATCH /v1/memories/{id}\n */\n async update(\n params: {\n /** The unique identifier of the memory */\n id: string;\n /** Collection context for copy-on-write. If provided and engram is shared, creates a copy before modification. */\n collectionId?: string | null;\n body: components[\"schemas\"][\"UpdateMemoryRequest\"];\n},\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"Engram\"]> {\n const response = (await this.core.request<components[\"schemas\"][\"WrappedEngram\"]>({\n method: \"PATCH\",\n path: \"/v1/memories/{id}\",\n pathParams: { id: params.id },\n query: { collection_id: params.collectionId },\n body: params.body,\n idempotent: false,\n signal: options?.signal,\n })) as { results: components[\"schemas\"][\"Engram\"] };\n return response.results;\n }\n\n}","// AUTOGENERATED by nebula-sdks/generator. Do not edit by hand.\n// Source: nebula-sdks/openapi/openapi.json\n\nimport type { components } from \"../types.ts\";\nimport type { NebulaCore } from \"../runtime/client.ts\";\n\nexport interface RequestOptions {\n signal?: AbortSignal;\n}\n\nexport class SnapshotsResource {\n constructor(private readonly core: NebulaCore) {}\n\n /**\n *\n * Export a collection snapshot\n * \n * Export a collection's full graph state as a\n * portable SnapshotEnvelope.\n * @operationId snapshots.export\n * @endpoint POST /v1/device-memory/snapshot/export\n */\n async export(\n body: components[\"schemas\"][\"SnapshotExportRequest\"],\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"SnapshotEnvelope-Output\"]> {\n const response = (await this.core.request<components[\"schemas\"][\"WrappedSnapshotEnvelope\"]>({\n method: \"POST\",\n path: \"/v1/device-memory/snapshot/export\",\n pathParams: {},\n query: undefined,\n body: body,\n idempotent: true,\n signal: options?.signal,\n })) as { results: components[\"schemas\"][\"SnapshotEnvelope-Output\"] };\n return response.results;\n }\n\n /**\n *\n * Import a snapshot into an ephemeral collection\n * \n * Import a SnapshotEnvelope into an ephemeral\n * collection. Returns the ephemeral collection UUID.\n * @operationId snapshots.import\n * @endpoint POST /v1/device-memory/snapshot/import\n */\n async import(\n body: components[\"schemas\"][\"SnapshotImportRequest\"],\n options?: RequestOptions,\n ): Promise<components[\"schemas\"][\"SnapshotImportResult\"]> {\n const response = (await this.core.request<components[\"schemas\"][\"WrappedSnapshotImportResult\"]>({\n method: \"POST\",\n path: \"/v1/device-memory/snapshot/import\",\n pathParams: {},\n query: undefined,\n body: body,\n idempotent: false,\n signal: options?.signal,\n })) as { results: components[\"schemas\"][\"SnapshotImportResult\"] };\n return response.results;\n }\n\n}","// AUTOGENERATED by nebula-sdks/generator. Do not edit by hand.\n// Source: nebula-sdks/openapi/openapi.json\n\nimport { NebulaCore, type ClientOptions } from \"./runtime/client.ts\";\nimport { ClientResource } from \"./resources/client.ts\";\nimport { CollectionsResource } from \"./resources/collections.ts\";\nimport { ConnectorsResource } from \"./resources/connectors.ts\";\nimport { MemoriesResource } from \"./resources/memories.ts\";\nimport { SnapshotsResource } from \"./resources/snapshots.ts\";\n\nexport class NebulaClient {\n protected readonly core: NebulaCore;\n readonly client: ClientResource;\n readonly collections: CollectionsResource;\n readonly connectors: ConnectorsResource;\n readonly memories: MemoriesResource;\n readonly snapshots: SnapshotsResource;\n\n constructor(options: ClientOptions = {}) {\n this.core = new NebulaCore(options);\n this.client = new ClientResource(this.core);\n this.collections = new CollectionsResource(this.core);\n this.connectors = new ConnectorsResource(this.core);\n this.memories = new MemoriesResource(this.core);\n this.snapshots = new SnapshotsResource(this.core);\n }\n}","// Handwritten Nebula DX layer.\n//\n// Carries only the methods that need real dispatch logic: storeMemory's\n// create-vs-append branch, bulk storeMemories with a concurrency cap,\n// positional connector helpers (connectProvider/listConnections/\n// disconnectConnection), and auth normalization.\n//\n// For everything else, use the resource methods directly. Resource\n// methods now return unwrapped values natively (the generator peels\n// the `{results: X}` wire envelope), so there's no separate auto-\n// generated unwrap layer to extend.\n//\n// Source of truth: nebula-sdks/custom/typescript/dx.ts\n// The generator copies this file into sdks/typescript/src/lib/dx.ts on every\n// `bun run generate`. Edit the source, not the copy.\n\nimport { NebulaClient } from \"../client.ts\";\nimport {\n type ClientOptions,\n type components,\n} from \"../index.ts\";\n\ntype Schemas = components[\"schemas\"];\ntype SnapshotEnvelopeInput = Schemas[\"SnapshotEnvelope-Input\"];\ntype SnapshotEnvelopeOutput = Schemas[\"SnapshotEnvelope-Output\"];\n\nexport type CompatClientOptions = ClientOptions & {\n apiKey?: string | null;\n baseUrl?: string | null;\n // Stainless-shape capital-U alias. Some internal callers\n // (backend/local-websocket-server, backend/lambda/websocket-llm) still\n // pass `baseURL`; without this alias the value falls through unused\n // and the runtime defaults to api.zeroset.com.\n baseURL?: string | null;\n // Stainless-shape alias for `timeoutMs`. Same compat reason.\n timeout?: number | null;\n bearerToken?: string | null;\n};\n\nexport interface MemoryCommonInput {\n collection_id?: string | null;\n collectionId?: string | null;\n content?: string | string[] | unknown[] | null;\n raw_text?: string | null;\n chunks?: Array<string> | null;\n messages?: unknown[] | null;\n metadata?: { [key: string]: unknown } | null;\n ingestion_config?: unknown;\n ingestion_mode?: string | null;\n}\n\nexport interface MemoryCreateInput extends MemoryCommonInput {\n kind?: Schemas[\"EngramKind\"] | null;\n name?: string | null;\n speaker_id?: string | null;\n speaker_name?: string | null;\n content_parts?: unknown[] | null;\n contents?: string[] | null;\n snapshot?: SnapshotEnvelopeInput | null;\n memory_id?: undefined | null;\n}\n\nexport interface MemoryAppendInput extends Omit<MemoryCommonInput, \"ingestion_mode\" | \"messages\"> {\n memory_id: string;\n ingestion_mode?: string | null;\n messages?: unknown[] | null;\n}\n\nexport type MemoryInput = MemoryCreateInput | MemoryAppendInput;\n\ntype MemoryCreateBody = Schemas[\"CreateMemoryRequest\"];\ntype MemoryAppendBody = Schemas[\"AppendMemoryRequest\"];\n\nexport class Nebula extends NebulaClient {\n constructor(options: CompatClientOptions = {}) {\n super(normalizeAuthOptions(normalizeClientOptions(options)));\n }\n\n /**\n * Polymorphic memory creator: dispatches to memories.create or memories.append\n * based on whether `memory_id` is set on the input. Returns the new memory's\n * id (string), or — when `snapshot` is set — the updated snapshot envelope.\n */\n async storeMemory(\n memory: MemoryInput,\n options?: { signal?: AbortSignal }\n ): Promise<string | SnapshotEnvelopeOutput> {\n if (\"memory_id\" in memory && memory.memory_id != null) {\n const memoryID = memory.memory_id;\n await this.memories.append(\n { id: memoryID, body: toMemoryAppendParams(memory) },\n options\n );\n return memoryID;\n }\n // `memories.create` now returns the unwrapped inner type directly\n // (the generator peels the wire `{results: X}` envelope).\n const result = await this.memories.create(\n toMemoryCreateParams(memory as MemoryCreateInput),\n options\n );\n if (isSnapshotResult(result)) {\n return (result.snapshot ?? result) as SnapshotEnvelopeOutput;\n }\n return extractID(result);\n }\n\n /**\n * Bulk parallel version of storeMemory with a concurrency cap.\n *\n * Default 8 concurrent in-flight requests matches the Python DX's\n * `asyncio.Semaphore(max_concurrency)` pattern. Use `maxConcurrency: 1`\n * for strictly serial submission; higher values risk overwhelming the\n * server when memories[] is large.\n */\n async storeMemories(\n memories: MemoryInput[],\n options?: { signal?: AbortSignal; maxConcurrency?: number }\n ): Promise<(string | SnapshotEnvelopeOutput)[]> {\n const cap = Math.max(1, options?.maxConcurrency ?? 8);\n const signal = options?.signal;\n const results: (string | SnapshotEnvelopeOutput)[] = new Array(memories.length);\n let nextIndex = 0;\n const worker = async (): Promise<void> => {\n while (true) {\n const i = nextIndex++;\n if (i >= memories.length) return;\n results[i] = await this.storeMemory(memories[i], { signal });\n }\n };\n await Promise.all(\n Array.from({ length: Math.min(cap, memories.length) }, () => worker())\n );\n return results;\n }\n\n /**\n * List memories scoped to one or more collection ids (string | string[])\n * or a full MemoryListParams object.\n */\n async listMemories(\n query: string | string[] | Record<string, unknown>,\n options?: { signal?: AbortSignal }\n ): Promise<unknown> {\n const normalized: Record<string, unknown> =\n typeof query === \"string\" || Array.isArray(query)\n ? { collectionIds: arrayify(query) }\n : query;\n return this.memories.list(normalized as never, options);\n }\n\n /**\n * Positional `connectProvider(provider, collectionID, config?)` — wraps the\n * generated `connectors.connect({provider, body})` to build the body shape.\n */\n async connectProvider(\n provider: string,\n collectionID: string,\n config?: Record<string, unknown>,\n options?: { signal?: AbortSignal }\n ): Promise<unknown> {\n const body: Schemas[\"ConnectRequest\"] = {\n collection_id: collectionID,\n ...(config !== undefined ? { config } : {}),\n } as Schemas[\"ConnectRequest\"];\n return this.connectors.connect({ provider, body }, options);\n }\n\n /** Positional listConnections(collectionID) — wraps the query wrapper. */\n async listConnections(\n collectionID: string,\n options?: { signal?: AbortSignal }\n ): Promise<unknown> {\n return this.connectors.list({ collectionId: collectionID } as never, options);\n }\n\n /** Positional disconnect(connectionID, deleteMemories?). */\n async disconnectConnection(\n connectionID: string,\n deleteMemories = false,\n options?: { signal?: AbortSignal }\n ): Promise<unknown> {\n return this.connectors.disconnect(\n { connectionId: connectionID, deleteMemories } as never,\n options\n );\n }\n\n /** Alias for disconnectConnection (same arg shape). */\n async disconnect(\n connectionID: string,\n deleteMemories = false,\n options?: { signal?: AbortSignal }\n ): Promise<unknown> {\n return this.connectors.disconnect(\n { connectionId: connectionID, deleteMemories } as never,\n options\n );\n }\n\n}\n\n// ---------- helpers ----------\n\nfunction normalizeAuthOptions(options: ClientOptions): ClientOptions {\n if (\n options.apiKey != null &&\n options.bearerToken == null &&\n !looksLikeNebulaAPIKey(options.apiKey)\n ) {\n return { ...options, apiKey: undefined, bearerToken: options.apiKey };\n }\n return options;\n}\n\nfunction normalizeClientOptions(options: CompatClientOptions): ClientOptions {\n const {\n apiKey,\n baseUrl: baseUrlAlias,\n baseURL: baseURLCapAlias,\n timeout: timeoutAlias,\n bearerToken,\n ...rest\n } = options;\n const restClientOptions: ClientOptions = rest;\n return {\n ...restClientOptions,\n apiKey: apiKey ?? undefined,\n bearerToken: bearerToken ?? undefined,\n baseUrl:\n firstDefined(restClientOptions.baseUrl, baseUrlAlias, baseURLCapAlias) ?? undefined,\n timeoutMs:\n firstDefined(restClientOptions.timeoutMs, timeoutAlias) ?? undefined,\n };\n}\n\nfunction firstDefined<T>(...values: (T | null | undefined)[]): T | null | undefined {\n return values.find((value) => value !== undefined);\n}\n\nexport function looksLikeNebulaAPIKey(token: string): boolean {\n const parts = token.split(\".\");\n if (parts.length !== 2) return false;\n const [publicPart, rawPart] = parts;\n return Boolean(rawPart) && (publicPart.startsWith(\"key_\") || publicPart.startsWith(\"neb_\"));\n}\n\nfunction toMemoryCreateParams(memory: MemoryCreateInput): MemoryCreateBody {\n const collectionID = memory.collection_id ?? memory.collectionId ?? undefined;\n const { collectionId: _ignore, content, memory_id: _ignoreMemoryID, ...rest } = memory;\n const params: Record<string, unknown> = { ...rest };\n\n if (collectionID !== undefined) {\n params.collection_id = collectionID;\n }\n if (content != null) {\n if (typeof content === \"string\") {\n params.raw_text = content;\n } else {\n params.content_parts = content;\n }\n }\n if (params.messages != null && !params.kind) {\n params.kind = \"conversation\";\n }\n return params as MemoryCreateBody;\n}\n\nfunction toMemoryAppendParams(memory: MemoryAppendInput): MemoryAppendBody {\n const collectionID = memory.collection_id ?? memory.collectionId ?? undefined;\n if (!collectionID) {\n throw new Error(\"collection_id is required when appending to an existing memory\");\n }\n const params: Record<string, unknown> = { collection_id: collectionID };\n for (const key of [\"metadata\", \"ingestion_config\", \"ingestion_mode\", \"raw_text\", \"chunks\", \"messages\"] as const) {\n const value = memory[key as keyof MemoryAppendInput];\n if (value != null) params[key] = value;\n }\n const content = (memory as MemoryCommonInput).content;\n if (content != null) {\n if (typeof content === \"string\") {\n params.raw_text = content;\n } else if (Array.isArray(content) && content.every((item) => typeof item === \"string\")) {\n params.chunks = content;\n } else if (Array.isArray(content)) {\n params.messages = content;\n }\n }\n return params as MemoryAppendBody;\n}\n\nfunction extractID(value: unknown): string {\n if (typeof value === \"object\" && value !== null) {\n const record = value as Record<string, unknown>;\n const id =\n record[\"id\"] ?? record[\"memory_id\"] ?? record[\"engram_id\"] ?? record[\"ephemeral_collection_id\"];\n if (typeof id === \"string\") return id;\n }\n throw new Error(\"Nebula memory create response did not include an id\");\n}\n\nfunction isSnapshotResult(value: unknown): value is { snapshot?: SnapshotEnvelopeOutput } {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"snapshot\" in (value as Record<string, unknown>)\n );\n}\n\nfunction arrayify(value: string | string[]): string[] {\n return Array.isArray(value) ? value : [value];\n}\n"],"mappings":";;;;;AAAA,IAAa,cAAb,cAAiC,MAAM;CACrC,OAAiC;CACjC,YAAY,SAAiB,SAA+B;EAC1D,MAAM,SAAS,OAAO;CACxB;AACF;AAEA,IAAa,wBAAb,cAA2C,YAAY;CACrD,OAAyB;AAC3B;AAEA,IAAa,qBAAb,cAAwC,YAAY;CAClD,OAAyB;AAC3B;AA6BA,SAAS,WAAW,MAAsC;CACxD,OACE,OAAO,SAAS,YAChB,SAAS,QACT,OAAQ,KAA4B,SAAS,YAC7C,OAAQ,KAA+B,YAAY;AAEvD;AAEA,IAAa,iBAAb,cAAoC,YAAY;CAC9C,OAAiC;CACjC;CACA;CACA;CAKA;CACA;CACA;CAEA,YAAY,SAA0B,SAAkB;EACtD,MAAM,WAAW,WAAW,QAAQ,I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