module documentation

Picoware Agent - LLM-powered assistant with chat GUI.

Function run Main frame handler, delegates to current state.
Function start Build main menu. Return True on success.
Function stop Tear down widgets and agent, reset state.
Constant STATE_CHAT Undocumented
Constant STATE_MENU Undocumented
Constant STATE_PROCESSING Undocumented
Constant STATE_SESSIONS Undocumented
Constant STATE_SETTINGS Undocumented
Constant STATE_SETTINGS_MODEL Undocumented
Constant STATE_SETTINGS_PROVIDER Undocumented
Constant STATE_SETTINGS_THINKING Undocumented
Constant STATE_TYPE Undocumented
Function _back_to_settings_menu Clean up the Choice sub-view and return to the settings menu.
Function _chat_layout Return layout metrics derived from screen size and default font.
Function _draw_bubble Draw a rounded-rect bubble clipped to screen bounds.
Function _get_llm_models Return a list of models for the specified LLM provider.
Function _get_llm_providers Return a list of available LLM providers.
Function _open_model_choice Open a Choice sub-view for selecting the LLM model.
Function _open_provider_choice Open a Choice sub-view for selecting the LLM provider.
Function _open_session Load the selected session and open it in chat mode.
Function _open_thinking_choice Open a Choice sub-view for selecting the LLM thinking level.
Function _render_chat Draw conversation as chat bubbles with scroll and prompt bar.
Function _save_settings Persist the current agent settings to storage.
Function _set_settings Load or create the agent settings.
Function _show_thinking Clear screen and display a centred thinking indicator.
Function _start_agent Create an agent and load or create its conversation session.
Function _start_sessions_menu Build and display the stored agent sessions menu.
Function _start_settings_menu Show the agent settings menu.
Function _wrap_text Wrap text to max_chars per line, preserving words.
Variable _agent Undocumented
Variable _agent_mode Undocumented
Variable _choice Undocumented
Variable _conversation Undocumented
Variable _loading Undocumented
Variable _max_scroll Undocumented
Variable _menu Undocumented
Variable _mode_label Undocumented
Variable _scroll_offset Undocumented
Variable _session_id Undocumented
Variable _session_ids Undocumented
Variable _session_labels Undocumented
Variable _sessions_menu Undocumented
Variable _settings Undocumented
Variable _settings_menu Undocumented
def run(view_manager):

Main frame handler, delegates to current state.

Parameters
view_manager:ViewManagerThe view manager context.
def start(view_manager) -> bool:

Build main menu. Return True on success.

Parameters
view_manager:ViewManagerThe view manager context.
Returns
boolTrue on success.
def stop(view_manager):

Tear down widgets and agent, reset state.

Parameters
view_manager:ViewManagerThe view manager context.
STATE_CHAT =

Undocumented

Value
const(1)
STATE_MENU =

Undocumented

Value
const(0)
STATE_PROCESSING =

Undocumented

Value
const(2)
STATE_SESSIONS =

Undocumented

Value
const(8)
STATE_SETTINGS =

Undocumented

Value
const(4)
STATE_SETTINGS_MODEL =

Undocumented

Value
const(6)
STATE_SETTINGS_PROVIDER =

Undocumented

Value
const(5)
STATE_SETTINGS_THINKING =

Undocumented

Value
const(7)
STATE_TYPE =

Undocumented

Value
const(3)
def _back_to_settings_menu(view_manager):

Clean up the Choice sub-view and return to the settings menu.

Parameters
view_manager:ViewManagerThe view manager context.
def _chat_layout(view_manager):

Return layout metrics derived from screen size and default font.

Parameters
view_manager:ViewManagerThe view manager context.
Returns
tupleHeader/prompt/chat geometry and font metrics.
def _draw_bubble(draw, x, y, w, text_lines, font, bg_color, text_color, pad, clip_top=0):

Draw a rounded-rect bubble clipped to screen bounds.

Parameters
draw:DrawThe drawing context.
x:intLeft position of the bubble.
y:intTop position of the bubble.
w:intWidth of the bubble.
text_lines:listLines of text to draw.
font:FontThe font to use.
bg_color:intBubble background color.
text_color:intText color.
pad:intInner padding in pixels.
clip_top:intY position to clip lines above. Defaults to 0.
Returns
intThe next Y position after the bubble.
def _get_llm_models(view_manager, llm_id: int) -> list:

Return a list of models for the specified LLM provider.

Parameters
view_manager:ViewManagerThe view manager context.
llm_id:intThe provider ID.
Returns
listAvailable model names.
def _get_llm_providers() -> list:

Return a list of available LLM providers.

def _open_model_choice(view_manager):

Open a Choice sub-view for selecting the LLM model.

Parameters
view_manager:ViewManagerThe view manager context.
def _open_provider_choice(view_manager):

Open a Choice sub-view for selecting the LLM provider.

Parameters
view_manager:ViewManagerThe view manager context.
def _open_session(view_manager) -> bool:

Load the selected session and open it in chat mode.

Parameters
view_manager:ViewManagerThe view manager context.
Returns
boolTrue if the session was opened.
def _open_thinking_choice(view_manager):

Open a Choice sub-view for selecting the LLM thinking level.

Parameters
view_manager:ViewManagerThe view manager context.
def _render_chat(view_manager):

Draw conversation as chat bubbles with scroll and prompt bar.

Parameters
view_manager:ViewManagerThe view manager context.
def _save_settings(view_manager) -> bool:

Persist the current agent settings to storage.

Parameters
view_manager:ViewManagerThe view manager context.
Returns
boolTrue on success.
def _set_settings(view_manager):

Load or create the agent settings.

Parameters
view_manager:ViewManagerThe view manager context.
def _show_thinking(view_manager):

Clear screen and display a centred thinking indicator.

Parameters
view_manager:ViewManagerThe view manager context.
def _start_agent(view_manager, mode: int, mode_label: str, session_id: str = None) -> bool:

Create an agent and load or create its conversation session.

Parameters
view_manager:ViewManagerThe view manager context.
mode:intThe agent mode to use.
mode_label:strThe label shown in the chat header.
session_id:str or NoneExisting session ID to load.
Returns
boolTrue if the agent and session were initialized.
def _start_sessions_menu(view_manager):

Build and display the stored agent sessions menu.

Parameters
view_manager:ViewManagerThe view manager context.
def _start_settings_menu(view_manager):

Show the agent settings menu.

Parameters
view_manager:ViewManagerThe view manager context.
def _wrap_text(text: str, max_chars: int):

Wrap text to max_chars per line, preserving words.

Parameters
text:strThe text to wrap.
max_chars:intMaximum characters per line.
Returns
listWrapped lines of text.
_agent =

Undocumented

_agent_mode =

Undocumented

_choice =

Undocumented

_conversation =

Undocumented

_loading =

Undocumented

_max_scroll: int =

Undocumented

_menu =

Undocumented

_mode_label: str =

Undocumented

_scroll_offset: int =

Undocumented

_session_id =

Undocumented

_session_ids =

Undocumented

_session_labels =

Undocumented

_sessions_menu =

Undocumented

_settings =

Undocumented

_settings_menu =

Undocumented