export { VectorStorageService, VECTOR_MIN_TTL_SECONDS, VECTOR_MAX_TTL_SECONDS, VECTOR_DEFAULT_TTL_SECONDS, VectorUpsertBaseSchema, VectorUpsertEmbeddingsSchema, VectorUpsertTextSchema, VectorUpsertParamsSchema, VectorSearchParamsSchema, VectorSearchResultSchema, VectorSearchResultWithDocumentSchema, VectorUpsertResultSchema, VectorResultFoundSchema, VectorResultNotFoundSchema, VectorResultSchema, VectorNamespaceStatsSchema, VectorNamespaceStatsWithSamplesSchema, VectorItemStatsSchema, VectorGetAllStatsParamsSchema, VectorStatsPaginatedSchema, VectorSortFieldSchema, } from '@agentuity/core/vector';
import { VectorStorageService, } from '@agentuity/core/vector';
import { createServerFetchAdapter, buildClientHeaders } from '@agentuity/adapter';
import { createMinimalLogger } from '@agentuity/core';
import { getEnv } from '@agentuity/core';
import { getServiceUrls } from '@agentuity/core/config';
import { z } from 'zod';
const isLogger = (val) => typeof val === 'object' &&
    val !== null &&
    ['info', 'warn', 'error', 'debug', 'trace'].every((m) => typeof val[m] === 'function');
export const VectorClientOptionsSchema = z.object({
    apiKey: z.string().optional().describe('API key for authentication'),
    url: z.string().optional().describe('Base URL for the Vector API'),
    orgId: z.string().optional().describe('Organization ID for multi-tenant operations'),
    logger: z.custom(isLogger).optional().describe('Custom logger instance'),
});
export class VectorClient {
    #service;
    constructor(options = {}) {
        const validatedOptions = VectorClientOptionsSchema.parse(options);
        const apiKey = validatedOptions.apiKey || getEnv('AGENTUITY_SDK_KEY') || getEnv('AGENTUITY_CLI_KEY');
        const region = getEnv('AGENTUITY_REGION') ?? 'usc';
        const serviceUrls = getServiceUrls(region);
        const url = validatedOptions.url || getEnv('AGENTUITY_VECTOR_URL') || serviceUrls.vector;
        const logger = validatedOptions.logger ?? createMinimalLogger();
        const headers = buildClientHeaders({
            apiKey,
            orgId: validatedOptions.orgId,
        });
        const adapter = createServerFetchAdapter({ headers }, logger);
        this.#service = new VectorStorageService(url, adapter);
    }
    async upsert(name, ...documents) {
        return this.#service.upsert(name, ...documents);
    }
    async get(name, key) {
        return this.#service.get(name, key);
    }
    async getMany(name, ...keys) {
        return this.#service.getMany(name, ...keys);
    }
    async search(name, params) {
        return this.#service.search(name, params);
    }
    async delete(name, ...keys) {
        return this.#service.delete(name, ...keys);
    }
    async exists(name) {
        return this.#service.exists(name);
    }
    async getStats(name) {
        return this.#service.getStats(name);
    }
    async getAllStats(params) {
        return this.#service.getAllStats(params);
    }
    async getNamespaces() {
        return this.#service.getNamespaces();
    }
    async deleteNamespace(name) {
        return this.#service.deleteNamespace(name);
    }
}
//# sourceMappingURL=index.js.map