@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
23 lines • 1.02 kB
JavaScript
import { IOResult } from "../../../../../io/types.js";
import { PathSpec } from "../../../../../types.js";
import { sedGeneric } from "../../sed.js";
import { crossOpts, fileStreamOp, flatScopes } from "../utils.js";
import { Files } from "../../../../../workspace/files.js";
/**
* GNU sed 4.9 keeps filenames and file boundaries for F and -s, and
* shares output files and quit state even under -i. Run one machine
* over the expanded operands through their owning mounts' dispatcher.
*/
export async function runSed(scopes, texts, bag, dispatch, stdin, cwd, argv,
// The session's environment, whose locale decides bytes or characters.
env) {
return ((await sedGeneric(flatScopes(scopes), texts, {
...crossOpts(bag),
stdin,
cwd: PathSpec.fromStrPath(cwd),
vfs: new Files(dispatch, null, null, { ledger: false }).servedBy(null),
argv,
...(env !== undefined ? { env } : {}),
}, fileStreamOp(dispatch))) ?? [null, new IOResult()]);
}
//# sourceMappingURL=sed.js.map