UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

23 lines • 955 B
import { enoent } from "../../errors/fs.js"; import { stripSlash } from "../../utils/slash.js"; export const LEAVES = ['run.json', 'config.json', 'summary.json', 'history.jsonl']; export function safeName(name) { return (name.length > 0 && !['.', '..'].includes(name) && !['/', '\\', '\0'].some((char) => name.includes(char))); } export function parts(accessor, path) { const key = stripSlash(path.mountPath); const result = key ? key.split('/') : []; if (result.some((p) => !safeName(p)) || (result.length > 0 && !accessor.config.entities.includes(result[0] ?? ''))) throw enoent(path); return result; } export function runVars(segments) { const [entity, project, run] = segments; if (entity === undefined || project === undefined || run === undefined) throw new Error('W&B run path requires three components'); return { entity, project, run }; } //# sourceMappingURL=pathing.js.map