Skip to main content

read_task_prompt

Function read_task_prompt 

Source
pub(crate) fn read_task_prompt(jsonl_path: &str) -> Option<String>
Expand description

Read just the subagent’s own initial task prompt from the first JSONL line (a "type":"user" init record) — used by subagent.GenerateName as the source text for the Haiku naming call. Deliberately bypasses the events cache/offset machinery read_jsonl_from_offset uses: naming only ever needs the first line, is called at most once per subagent (cached via display_name thereafter), and must work even for a subagent whose events haven’t been scanned into SubagentState yet.

message.content is either a plain string or an array of content blocks (mirrors the two shapes parse_event_type’s “assistant” arm already handles) — both are accepted here.