@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
63 lines (62 loc) • 2.25 kB
JavaScript
import { WandbAccessor } from "../../accessor/wandb.js";
import { WandbConfig } from "../../core/wandb/config.js";
import { readStream } from "../../core/wandb/read.js";
import { readdir } from "../../core/wandb/readdir.js";
import { stat } from "../../core/wandb/stat.js";
import {} from "../../io/types.js";
import { VFSName } from "../../types.js";
import { BaseVFS } from "../base.js";
export const VFS_MD = `\`\`\`text
{prefix}
<entity>/
<project>/
<run-id>/
run.json
config.json
summary.json
history.jsonl
files/
\`\`\`
- Read only. Only configured entities are visible. Run IDs are stable;
display names may repeat.
- \`run.json\` holds identity, creator, sweep/group/job, tags, timestamps,
notes, system metrics, history keys and count, and file count. Its
\`user\` contains the creator's id, name, username and email, when
available; its \`read_only\` is W&B's permission, not the mount mode.
Missing run metadata is \`null\`.
- \`history.jsonl\` scans unsampled history in original order, preserving
missing metrics and \`_step\`. Logged training-step keys are independent
of \`_step\`. History reads may be large; use \`head\` to stream a prefix.
- \`summary.json\` metrics are stored values, not history maxima.
- \`files/\` keeps run-relative paths; \`files/wandb-metadata.json\`, when
present, describes the machine and runtime environment.
- Listings and reads are lazy.`;
export class WandbVFS extends BaseVFS {
handed = {
readdir: ['index'],
stat: ['entry'],
};
name = VFSName.WANDB;
vfsMd = VFS_MD;
config;
accessor;
constructor(config) {
super();
this.config = config;
this.accessor = new WandbAccessor(config);
}
readdir(path, handed) {
return readdir(this.accessor, path, handed?.index, handed?.limit);
}
// eslint-disable-next-line @typescript-eslint/require-await
async read(path) {
return readStream(this.accessor, path);
}
stat(path, handed) {
return stat(this.accessor, path, handed?.entry);
}
getState() {
return Promise.resolve(this.configState(WandbConfig, this.config));
}
}
//# sourceMappingURL=wandb.js.map