Skip to main content

Module background

Module background 

Source
Expand description

Compatibility path for native background-job state.

Structs§

CapturedOutput
Bounded, incrementally-appended output capture shared (via Arc) between a job’s stdout/stderr reader tasks and whatever later polls it (background_status/background_list). Thread-safe; every method is fail-soft on a poisoned lock (treats it as “temporarily unavailable”, the same posture crate::permissions::approval::ApprovalCache already documents for itself) rather than panicking a reader task or a tool call.

Enums§

JobStatus
A background job’s run state, as observed by background_status/ background_list.

Constants§

DEFAULT_MAX_CONCURRENT
P5-6 (resource bound, mirroring crate::subagents’s “max concurrent… cap, fail-closed… configurable” precedent): the default maximum number of background jobs this agent may have in flight at once.
DEFAULT_MAX_OUTPUT_BYTES
P5-6 (build brief “cap the buffer like P5-2’s 16MiB caps”): the default per-job bounded-capture ceiling, matching crate::mcp::MCP_MAX_RESPONSE_BYTES’s hardening precedent — generous for real command output while bounding how much memory one background job (let alone max_concurrent of them at once) can force this process to hold.

Functions§

next_job_id
A fresh, process-unique background job id ("bg-<hex-ts>-<hex-seq>"), given the caller’s own millisecond timestamp (kept as a parameter rather than reading the clock in here, so this stays a pure function for the unit tests below).