Class CaptureManager

java.lang.Object
com.shaft.capture.runtime.CaptureManager
All Implemented Interfaces:
AutoCloseable

public final class CaptureManager extends Object implements AutoCloseable
Thread-safe local lifecycle API shared by CLI and MCP capture controls.
  • Constructor Details

    • CaptureManager

      public CaptureManager()
      Creates the default managed recorder lifecycle.
  • Method Details

    • start

      public CaptureStatus start(CaptureStartRequest request)
      Starts one managed browser capture.
      Parameters:
      request - validated start request
      Returns:
      active recorder status
    • status

      public CaptureStatus status()
      Returns the latest safe status without captured values.
      Returns:
      recorder status
    • activeShaftDriver

      public Optional<SHAFT.GUI.WebDriver> activeShaftDriver()
      Returns the live SHAFT driver wrapping the recorded browser while a capture session is ACTIVE, so element-level tools can drive the recorded browser (agent-performed codegen: start a session, perform the described actions, stop, generate).
      Returns:
      the active session's SHAFT driver, or empty when no session is active
    • steps

      public List<CaptureStep> steps()
      Returns the current server-side step list for the active session, so the recorder UI (or an external control client) can rehydrate its step list from the session store rather than page-scoped browser storage.
      Returns:
      ordered safe step summaries, or an empty list when no session is active
    • mode

      public String mode()
      Returns the recorder's current live authoring mode: record (default; the recorder captures interactions as replayable steps) or inspect (the recorder overlay highlights hovered elements for a live locator pick instead of recording an interaction step). This is in-memory only, mirroring steps()/status(): it reflects the live recorder, not durable session state.
      Returns:
      "record" or "inspect"
    • setMode

      public String setMode(String requestedMode)
      Sets the recorder's live authoring mode.
      Parameters:
      requestedMode - "record" or "inspect" (case-insensitive)
      Returns:
      the mode now in effect
      Throws:
      IllegalArgumentException - when requestedMode is not a supported mode
    • networkTransactions

      public List<NetworkTransaction> networkTransactions()
      Returns the list of network transactions from the active session.
      Returns:
      ordered network transaction summaries, or an empty list when no session is active
    • networkTransactions

      public List<NetworkTransaction> networkTransactions(NetworkCaptureOptions options, int limit)
      Returns network transactions from the active session filtered per the supplied capture options, bounded to the most recent limit entries in capture order.
      Parameters:
      options - asset-noise and pattern filters; null applies no filtering
      limit - maximum number of transactions to return; non-positive values are treated as unbounded
      Returns:
      ordered, filtered, bounded network transaction summaries
    • checkpoint

      public CaptureStatus checkpoint(String description, Checkpoint.CheckpointKind kind)
      Adds a human-review checkpoint to the active session.
      Parameters:
      description - checkpoint description
      kind - checkpoint kind
      Returns:
      updated status
    • stop

      public CaptureStatus stop(boolean discard)
      Stops the active session.
      Parameters:
      discard - whether to remove capture artifacts after clean shutdown
      Returns:
      final status
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable