UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

44 lines • 1.91 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. ========= import { loadOptionalPeer } from "../utils/optional_peer.js"; import { Accessor } from "./base.js"; import { ResponseCache } from "./responses.js"; export class QdrantAccessor extends Accessor { config; indexesEnsured = new Set(); searches = new ResponseCache(); opened = null; constructor(config) { super(); this.config = config; } caches() { return [this.searches]; } /** The mount's client, opened on first use. */ async client() { if (this.opened === null) { const mod = (await loadOptionalPeer(() => import(/* @vite-ignore */ '@qdrant/js-client-rest'), { feature: 'QdrantVFS', packageName: '@qdrant/js-client-rest' })); const common = { timeout: this.config.timeout * 1000, ...(this.config.apiKey !== null ? { apiKey: this.config.apiKey } : {}), }; this.opened = new mod.QdrantClient(this.config.url !== null ? { url: this.config.url, ...common } : { host: this.config.host, port: this.config.port, https: this.config.https, ...common }); } return this.opened; } } //# sourceMappingURL=qdrant.js.map