54 lines
1.7 KiB
Rust
54 lines
1.7 KiB
Rust
//! Agent push & task-tracker handoff (Phase 10c, ADR-0011 Layer 3 — LATER).
|
|
//!
|
|
//! Optional "push" alternative to the MCP pull model: WA actively kicks off work from a
|
|
//! feature brief — either by spawning a local coding-agent CLI headless, or by opening a
|
|
//! tracker issue (which e.g. Copilot's cloud agent can pick up).
|
|
//!
|
|
//! Both are third-party egress where they reach a cloud (agent provider / tracker API):
|
|
//! off by default, explicit, labeled, allowlisted (FR-AGENT-1/2).
|
|
|
|
use crate::models::FeatureBrief;
|
|
use async_trait::async_trait;
|
|
use std::path::Path;
|
|
|
|
#[derive(Debug, thiserror::Error)]
|
|
pub enum AgentError {
|
|
#[error("agent CLI not found: {0}")]
|
|
NotFound(String),
|
|
#[error("run failed: {0}")]
|
|
Run(String),
|
|
#[error("tracker error: {0}")]
|
|
Tracker(String),
|
|
}
|
|
|
|
/// Streamed CLI output lines → "agent://progress" events.
|
|
pub type LineSink = std::sync::mpsc::Sender<String>;
|
|
|
|
pub struct RunOutcome {
|
|
pub branch: Option<String>,
|
|
pub pr_url: Option<String>,
|
|
}
|
|
|
|
/// Spawns a local coding-agent CLI headless against a repo (claude -p / codex exec / opencode run / copilot).
|
|
#[async_trait]
|
|
pub trait AgentRunner: Send + Sync {
|
|
async fn run(
|
|
&self,
|
|
brief: &FeatureBrief,
|
|
repo: &Path,
|
|
out: LineSink,
|
|
) -> Result<RunOutcome, AgentError>;
|
|
}
|
|
|
|
/// Creates a work item from a brief (e.g. a GitHub issue, optionally assigned to Copilot's cloud agent).
|
|
#[async_trait]
|
|
pub trait IssueTracker: Send + Sync {
|
|
async fn create_issue(
|
|
&self,
|
|
brief: &FeatureBrief,
|
|
assign_copilot: bool,
|
|
) -> Result<String /* url */, AgentError>;
|
|
}
|
|
|
|
// Concrete impls (CliAgentRunner, GitHubIssueTracker) are added in Phase 10c behind a feature flag.
|