java.lang.Object
eu.svjatoslav.alyverkko_cli.commands.task_processor.TaskProcess

public class TaskProcess extends Object
TODO: what if directory disappeared that contained original input file ? Response cannot be written back anymore.

Executes AI inference tasks through llama.cpp CLI. This class handles the complete workflow from prompt construction to response formatting, including temporary file management and process execution.

Key processing steps:

  1. Build standardized input prompt
  2. Create a temporary input file
  3. Execute llama.cpp with appropriate parameters
  4. Capture and filter output
  5. Perform cleanup operations

Temperature settings, context size, and thread counts are all derived from the current configuration. The response is formatted to match org-mode conventions while preserving original conversation structure.

  • Constructor Details

    • TaskProcess

      public TaskProcess(Task task)
      Creates a new AI task with a given mail query.
      Parameters:
      task - the mail query containing model and prompts.
  • Method Details

    • runAiQuery

      public String runAiQuery() throws InterruptedException, IOException
      Runs the AI query by constructing the prompt, writing it to a temp file, invoking llama.cpp, collecting output, and performing any final cleanup.
      Returns:
      the AI's response in a format suitable for appending back into the conversation file.
      Throws:
      InterruptedException - if the process is interrupted.
      IOException - if reading/writing the file fails or the process fails to start.