UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

38 lines • 1.78 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 { ContentType } from "../../types.js"; import { perAccessor } from "../hierarchy/bind.js"; import { Codec, PATH_SAFE } from "../hierarchy/codec.js"; import { makeDetectScope } from "../hierarchy/scope.js"; import { blobLeaf, rowScopes } from "../vector/scope.js"; const CARD = new Codec({ suffix: '.md' }); /** * The mount's scope table, shaped by its config. * * A pinned `table` removes the leading table segment, and `blobColumn` adds a * second leaf suffix beside the `.md` card. A group slot decodes through * `PATH_SAFE`, so a value holding `/` keeps its own directory and the WHERE * clause holds the exact value. */ export function scopesFor(config) { const leaves = [['row_card', CARD, ContentType.TEXT]]; if (config.blobColumn !== null) leaves.push(blobLeaf(config.blobExt)); return rowScopes(config.table !== null, config.groupBy.map(() => PATH_SAFE), leaves); } function buildDetect(accessor) { return makeDetectScope(scopesFor(accessor.config)); } export const detectFor = perAccessor(buildDetect); //# sourceMappingURL=scope.js.map