Skip to main content

Module mapping

Module mapping 

Source
Expand description

Pure translations between Leviath’s own types and the Agent Client Protocol.

Everything here is a total function over plain data - no I/O, no daemon, no async - so the stdio server in leviath-cli is left with only sequencing to do, and every mapping decision is unit-testable in isolation.

Constants§

OPTION_ALLOW_ALWAYS
The option id returned when the user approves this tool for the whole session.
OPTION_ALLOW_ONCE
The option id returned when the user approves a single tool call.
OPTION_REJECT_ONCE
The option id returned when the user rejects a tool call.

Functions§

flatten_prompt
Flatten a prompt’s content blocks into the single task/message string Leviath agents consume.
is_permission_request
Whether an interaction can be answered over the protocol at all.
parse_region_markers
Parse ---region:<name>--- markers out of a flattened prompt into a name→content map.
permission_request
Build a session/request_permission request from a Leviath tool-approval interaction.
stop_reason_for
The stop reason to report for a run that has reached status, or None while the run has not stopped at all.
stop_reason_for_label
stop_reason_for over the string labels carried by completion events, which report a terminal status by name rather than as a RunStatus. An unexpected label reads as an ordinary end of turn.