Class LocalFileSink

java.lang.Object
com.agentforge4j.runtime.command.LocalFileSink
All Implemented Interfaces:
FileSink

public final class LocalFileSink extends Object implements FileSink
FileSink that writes under baseDir, namespacing paths by runId and rejecting paths that escape the base directory.
  • Constructor Details

    • LocalFileSink

      public LocalFileSink(Path baseDir)
      Creates a sink rooted at baseDir.
      Parameters:
      baseDir - root directory for all runs; relative paths use the default file system rules
  • Method Details

    • write

      public void write(String runId, String stepId, String path, String content)
      Writes UTF-8 text to baseDir/runId/path, creating parent directories as needed.
      Specified by:
      write in interface FileSink
      Parameters:
      runId - id of the owning run — useful for scoping outputs per run
      stepId - id of the producing step
      path - the path the agent requested
      content - the file content
      Throws:
      IllegalArgumentException - if runId, stepId, or path is blank, or the resolved path escapes baseDir
      IllegalStateException - if the file cannot be written