Boot/Lilith.Worker.cscsharp

Documentation

Boot

Startup and readiness for the Lilith chat session.

Lilith.Boot.cs

  • BootAsync — initializes Ollama, prints the console banner, runs the opening greeting, and validates chat history.
  • GreetAsync — sends the initial “greet the user” prompt through the chat pipeline.
  • EnsureChatReadiness — confirms the Ollama client, system message, and context window are ready before user input.
namespace Lilith.Agent;public partial class Lilith{    public bool IsWorkerReady { get; private set; }    /// <summary>Initialize Ollama for a worker subagent (no user greet).</summary>    public async Task PrepareWorkerAsync(bool startServerIfNotRunning = false)    {        if (IsWorkerReady)        {            return;        }        await InitializeOllamaAsync(startServerIfNotRunning);        IsWorkerReady = true;        IsBooted = true;    }    /// <summary>Run one task turn with worker tools (get_time, get_date).</summary>    public async Task<string> RunTaskAsync(string message)    {        if (!IsWorkerReady)        {            await PrepareWorkerAsync();        }        return await ChatAsync(message) ?? "(no response)";    }}