UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

57 lines • 2.31 kB
// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. ========= // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ========= Copyright 2026 @ Strukto.AI All Rights Reserved. ========= var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) { if (typeof path === "string" && /^\.\.?\//.test(path)) { return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) { return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js"); }); } return path; }; import { loadOptionalPeer } from "../utils/optional_peer.js"; import { Accessor } from "./base.js"; export class ChromaAccessor extends Accessor { config; client = null; collection = null; constructor(config) { super(); this.config = config; } async getClient() { if (this.client === null) { const spec = 'chromadb'; const mod = (await loadOptionalPeer(() => import(__rewriteRelativeImportExtension(/* @vite-ignore */ spec)), { feature: 'ChromaVFS', packageName: 'chromadb', })); this.client = new mod.ChromaClient({ host: this.config.host, port: this.config.port, ssl: this.config.ssl, }); } return this.client; } async getCollection() { if (this.collection === null) { const client = await this.getClient(); this.collection = await client.getCollection({ name: this.config.collectionName, }); } return this.collection; } } //# sourceMappingURL=chroma.js.map