Skip to main content

Module detached

Module detached 

Source
Expand description

Shell commands that outran their grace period and finished in the background.

Every shell command starts in the foreground. One that has not exited by the time lifecycle.shell_grace_secs elapses is demoted: the turn gets a handle and carries on, the command keeps running on an OS thread of its own, and its output goes to a file rather than into the conversation. When it finishes, the runtime enqueues a task on this capsule with crate::origin::TaskOrigin::Completion carrying the exit code and that file’s path.

The handle is not addressable. Nothing takes a work id as an argument — no tool, no host import, no CLI subcommand — because a pollable handle invites a loop that burns turns waiting, which is the cost demotion exists to remove. A demoted command is learned about through its completion and no other way.

Constants§

WORK_ID_PREFIX
Prefix on every work id. Distinct from tsk_/ctx_/ses_ so a reader of trace.jsonl can tell at a glance which id space a value belongs to.

Functions§

new_work_id
A fresh work id, matching ^wrk_[0-9a-f]+$.