@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
47 lines • 1.92 kB
JavaScript
// ========= 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 { filesContaining } from "../../core/lancedb/search.js";
import { read, readdir, SEARCH, stat } from "../../core/lancedb/tree.js";
import { BaseVFS } from "../base.js";
export const VFS_MD = `- A LanceDB table, exposed as a filesystem.
- Directories are the configured group-by columns; descending one narrows
a filter.
- Each matching row is a \`<id>.md\` card plus a \`<id>.<ext>\` blob file.
- \`ls\`, \`cd\`, \`cat\`, \`tree\`, \`find\`, \`wc\`, \`grep\` and \`rg\` work as
usual.`;
/**
* LanceDB's functions over its accessor, which a host package builds
* over its own transport.
*/
export class LanceDBVFS extends BaseVFS {
readdir(path) {
return readdir(this.accessor, path);
}
async read(path) {
return read(this.accessor, path);
}
stat(path) {
return stat(this.accessor, path);
}
filesContaining(path, text, opts) {
return filesContaining(this.accessor, text, [path], opts.wholeWord, opts.ignoreCase);
}
search(path, query) {
return SEARCH.search(this.accessor, path, query);
}
searchMany(paths, query) {
return SEARCH.searchMany(this.accessor, paths, query);
}
}
//# sourceMappingURL=lancedb.js.map