M4: jobs pane, subtask drill-in, reminders
Adds the jobs pane to the TUI with a new snapshot test, subtask drill-in navigation, and periodic reminders injected into the engine loop for long-running background jobs.
This commit is contained in:
@@ -325,6 +325,8 @@ impl EngineHandle {
|
||||
instructions: self.inner.config.instructions.clone(),
|
||||
cost: Some(self.inner.catalog.cost(provider_id, model_id)),
|
||||
inject_job_board,
|
||||
reminder_turn_start: self.inner.reminder("turn_start"),
|
||||
reminder_after_file_tool: self.inner.reminder("after_file_tool"),
|
||||
};
|
||||
|
||||
// Reserve the run slot *before* spawning. If we inserted after spawning, a run that
|
||||
@@ -386,6 +388,18 @@ impl EngineHandle {
|
||||
Ok(self.inner.store.parts(message_id).await?)
|
||||
}
|
||||
|
||||
pub async fn get_session(&self, session_id: SessionId) -> Result<Option<Session>, AppError> {
|
||||
Ok(self.inner.store.session(session_id).await?)
|
||||
}
|
||||
|
||||
/// Background jobs spawned by `session_id` (the parent), for the TUI jobs pane / drill-in.
|
||||
pub async fn jobs(
|
||||
&self,
|
||||
session_id: SessionId,
|
||||
) -> Result<Vec<harness_core::engine::JobRecord>, AppError> {
|
||||
Ok(self.inner.store.jobs_for_parent(session_id).await?)
|
||||
}
|
||||
|
||||
pub fn is_running(&self, session_id: &SessionId) -> bool {
|
||||
let runs = self.inner.runs.lock().unwrap();
|
||||
runs.contains_key(session_id)
|
||||
@@ -477,6 +491,16 @@ impl EngineInner {
|
||||
}
|
||||
}
|
||||
|
||||
/// An optional orchestration reminder string by hook key (`turn_start`/`after_file_tool`).
|
||||
fn reminder(&self, key: &str) -> Option<String> {
|
||||
self.config
|
||||
.orchestration
|
||||
.reminders
|
||||
.as_ref()?
|
||||
.get(key)
|
||||
.cloned()
|
||||
}
|
||||
|
||||
/// The ruleset a session evaluates its own tool calls against: low-priority depth guards
|
||||
/// (depth > 0), then global config permissions, then the agent's own rules (highest).
|
||||
fn effective_static_rules(&self, agent: &AgentDef, depth: u8) -> Ruleset {
|
||||
@@ -712,6 +736,8 @@ impl SubagentSpawner for EngineInner {
|
||||
&child_session.model.model_id,
|
||||
)),
|
||||
inject_job_board: agent.mode.is_primary(),
|
||||
reminder_turn_start: self.reminder("turn_start"),
|
||||
reminder_after_file_tool: self.reminder("after_file_tool"),
|
||||
};
|
||||
|
||||
// Register the launch on the parent board (also makes foreground results reusable).
|
||||
|
||||
Reference in New Issue
Block a user