Skip to main content

Module tasks

Module tasks 

Source
Expand description

The background and one-shot ambient Haiku callers: pushed and per-definition activity summaries, subagent and workflow-batch names, and narration. Each is best-effort — every failure path returns None and the caller carries on without. They all go through call::admit / Slot::run, so admission, cancellation, concurrency caps and reply validation are the same for each.

The two pull RPCs (session:activity_summary, session:next_prompt_suggestion) use the same path from server::app_api::session.

Structs§

Generated
What a background call produced. None from a task means it did not run to completion (superseded, capped out, nothing to send, CLI failed), so a caller that tracks progress should try again later. Some means the CLI ran: text is None when the model had nothing usable to say (the reply failed validation, or was empty), which is a finished attempt, not a failure, and tokens is the spend either way.

Functions§

generate_ambient_narration
Generate a short user-facing line narrating an autonomous action.
generate_definition_activity_summary
Generate (and persist) a short activity summary for a definition whose AgentPicker row has no structured output.state.json conversation snapshot to preview — legacy rows predating snapshot persistence, per has_snapshot in agent_handlers::session::listrecentsessions. Built from the instance’s raw terminal capture (the "output" filestore file, written unconditionally by the CLI pipeline, independent of the newer structured snapshot), reusing read_recent_activity_digest — the same extraction generate_recovered_title above uses.
generate_subagent_name
Generate (or return the already-cached) concise Haiku display name for a subagent. Called on-demand the first time a client expands that subagent’s row in the Swarm view — see ("subagent", "GenerateName") in server::service::misc. Subagents have no Block/meta of their own, so this borrows the parent block’s CLI path + auth env, and reads the subagent’s own initial task prompt directly off its JSONL (available immediately even for a still-running subagent, unlike a transcript summary which needs output to summarize).
resolve_provider_cli_path_readonly
Read-only CLI path lookup for provider_id — checks the versioned local-install dir, then falls back to system PATH. Deliberately never installs anything (unlike the resolvecli RPC handler / agent_open.rs’s launch-time resolution, which both trigger an npm install as a fallback): this is a best-effort BACKGROUND call, not a user-initiated launch — silently installing a CLI as a side effect of a picker preview summary would be a surprising, unwanted cost. Returns None (not an error) for an unknown provider or a CLI that isn’t already available either way; the caller treats that the same as any other unresolvable case.