Skip to main content

Module task_framework

Module task_framework 

Source
Expand description

Task framework utilities. Contains task management, polling, and notification logic.

Structs§

TaskAttachment
Attachment type for task status updates
TaskOutput
Task output structure
TaskStateBase
Base task state

Enums§

TaskStatus
Task status
TaskType
Task types

Constants§

MAX_TASK_OUTPUT_BYTES
Maximum task output size in bytes
MAX_TASK_OUTPUT_BYTES_DISPLAY
Maximum task output size for display
OUTPUT_FILE_TAG
PANEL_GRACE_MS
Grace period for terminal local_agent tasks in the coordinator panel
POLL_INTERVAL_MS
Standard polling interval for all tasks
STATUS_TAG
STOPPED_DISPLAY_MS
Duration to display killed tasks before eviction
SUMMARY_TAG
TASK_ID_TAG
TASK_NOTIFICATION_TAG
TASK_TYPE_TAG
TOOL_USE_ID_TAG

Traits§

TaskStateTrait
Task state trait for type-safe updates

Functions§

append_task_output
Append to task output
apply_task_offsets_and_evictions
Apply the outputOffset patches and evictions from generate_task_attachments. Merges patches against fresh state.
cleanup_task_output
Cleanup task output
evict_task_output
Evict task output (remove old outputs)
evict_terminal_task
Eagerly evict a terminal task from AppState. The task must be in a terminal state (completed/failed/killed) with notified=true.
flush_task_output
Flush task output (ensure written to disk)
format_task_notification
Helper to format task notification XML
generate_task_attachments
Generate attachments for tasks with new output or status changes. Called by the framework to create push notifications.
get_running_tasks
Get all running tasks.
get_task_output
Get task output
get_task_output_delta
Get task output delta (for streaming)
get_task_output_path
Get task output path
get_task_output_size
Get task output size
init_task_output
Initialize task output
init_task_output_as_symlink
Initialize task output as symlink
is_terminal_task_status
True when a task is in a terminal state and will not transition further.
poll_tasks
Poll all running tasks and check for updates. This is the main polling loop called by the framework.
register_task
Register a new task in AppState.
update_task_state
Update a task’s state in AppState. Helper function for task implementations. Generic to allow type-safe updates for specific task types.

Type Aliases§

AppState
Type alias for app state
SetAppState
Type alias for set app state function