CompositeBackend

org.llm4s.agent.harness.CompositeBackend
See theCompositeBackend companion object
@Experimental
final class CompositeBackend extends FileBackend

Several backends as one tree: each route mounts a backend at a path, and a path goes to the backend of the longest mount it is within, segment by segment, or to default. The routed backend sees the path relative to its mount (/memories/notes.md is /notes.md to the backend mounted at /memories), so a backend means the same at any mount.

Mutations, their locks and their replay are the routed backend's. ls adds each mount beneath the directory as a directory; find and search (so glob and grep) span every backend beneath under, and a path of one backend that a deeper mount shadows is never listed.

Attributes

Companion
object
Source
CompositeBackend.scala
Graph
Supertypes
trait FileBackend
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

Deletes the file, or the empty directory, path.

Deletes the file, or the empty directory, path.

Attributes

Source
CompositeBackend.scala
def edit(path: VPath, old: String, replacement: String, replaceAll: Boolean, ctx: FileContext): Result[(FileEdited, StateUpdate)]

Replaces old with replacement in the file path: the one occurrence, or every occurrence when replaceAll. Refused when old is empty or absent, or occurs more than once and not replaceAll.

Replaces old with replacement in the file path: the one occurrence, or every occurrence when replaceAll. Refused when old is empty or absent, or occurs more than once and not replaceAll.

Attributes

Source
CompositeBackend.scala
def find(under: VPath, accept: VPath => Boolean, limit: Int, ctx: FileContext): Result[Listing[VPath]]

The files within under that accept takes, in path order, at most limit: accept is applied before the limit, so a file it refuses never takes a place (a composite passes a predicate that refuses the paths a mount shadows, and relies on this to fill its limit with visible files). search likewise.

The files within under that accept takes, in path order, at most limit: accept is applied before the limit, so a file it refuses never takes a place (a composite passes a predicate that refuses the paths a mount shadows, and relies on this to fill its limit with visible files). search likewise.

Attributes

Source
CompositeBackend.scala
def locks(path: VPath): Set[LockKey]

The locks a mutation of path holds.

The locks a mutation of path holds.

Attributes

Source
CompositeBackend.scala
def ls(path: VPath, limit: Int, ctx: FileContext): Result[Listing[FileInfo]]

The entries directly beneath the directory path, in path order, at most limit.

The entries directly beneath the directory path, in path order, at most limit.

Attributes

Source
CompositeBackend.scala
def read(path: VPath, offset: Int, limit: Int, ctx: FileContext): Result[FileLines]

At most limit lines of the file path, from the 0-based line offset.

At most limit lines of the file path, from the 0-based line offset.

Attributes

Source
CompositeBackend.scala
def search(under: VPath, regex: Pattern, accept: VPath => Boolean, limit: Int, ctx: FileContext): Result[Listing[GrepMatch]]

The lines matching regex of the files within under that accept takes, in path then line order. regex is the model's: match it with org.llm4s.security.RegexSafetyManager.safeFind, never a bare matcher, so a catastrophic pattern is bounded and cannot overflow the stack.

The lines matching regex of the files within under that accept takes, in path then line order. regex is the model's: match it with org.llm4s.security.RegexSafetyManager.safeFind, never a bare matcher, so a catastrophic pattern is bounded and cannot overflow the stack.

Attributes

Source
CompositeBackend.scala
def write(path: VPath, content: String, ctx: FileContext): Result[(FileWritten, StateUpdate)]

Writes the file path, creating it or replacing it.

Writes the file path, creating it or replacing it.

Attributes

Source
CompositeBackend.scala

Inherited methods

final def glob(pattern: Glob, under: VPath, limit: Int, ctx: FileContext): Result[Listing[VPath]]

The files within under whose path relative to under matches pattern.

The files within under whose path relative to under matches pattern.

Attributes

Inherited from:
FileBackend
Source
FileBackend.scala
final def grep(regex: String, under: VPath, include: Option[Glob], limit: Int, ctx: FileContext): Result[Listing[GrepMatch]]

The lines matching regex in the files within under. include filters the files: a pattern with no / matches a file's name, one with a / its path relative to under (as ripgrep's --glob).

The lines matching regex in the files within under. include filters the files: a pattern with no / matches a file's name, one with a / its path relative to under (as ripgrep's --glob).

Attributes

Inherited from:
FileBackend
Source
FileBackend.scala

Concrete fields

val writes: Set[StateKey[_, _]]

The state keys the StateUpdates of this backend's mutations touch; a tool declares them in writes.

The state keys the StateUpdates of this backend's mutations touch; a tool declares them in writes.

Attributes

Source
CompositeBackend.scala