fix(ticket-assistant): édition de ticket via les tools MCP idea_ticket_* (#27)
L'assistant IA d'édition de ticket éditait les fichiers du ticket en direct, hors de tout contrôle. Il passe désormais par les tools MCP idea_ticket_* : préparation d'un environnement structuré dédié et policy d'enforcement scopée au ticket courant, de sorte que l'assistant ne peut agir que sur son ticket via la surface MCP plutôt que sur le système de fichiers. Couvert par de nouveaux tests QA (mcp_server, assistant_context_store). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -128,6 +128,15 @@ pub struct PreparedContext {
|
||||
pub project_root: String,
|
||||
}
|
||||
|
||||
/// Prepared environment for a structured assistant session.
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct StructuredSessionEnvironment {
|
||||
/// Isolated cwd where the structured CLI must run.
|
||||
pub cwd: ProjectPath,
|
||||
/// Environment variables to pass to the structured session.
|
||||
pub env: Vec<(String, String)>,
|
||||
}
|
||||
|
||||
/// Errors returned while preparing the IdeA-owned ticket assistant context.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Error)]
|
||||
pub enum AssistantContextError {
|
||||
@ -153,6 +162,23 @@ pub trait AssistantContextProvider: Send + Sync {
|
||||
) -> Result<PreparedContext, AssistantContextError>;
|
||||
}
|
||||
|
||||
/// Prepares the isolated run environment for a structured ticket assistant.
|
||||
#[async_trait]
|
||||
pub trait StructuredSessionEnvironmentPreparer: Send + Sync {
|
||||
/// Materialises context and MCP configuration for a ticket assistant session.
|
||||
///
|
||||
/// # Errors
|
||||
/// [`RuntimeError`] when the structured environment cannot be prepared.
|
||||
async fn prepare_ticket_assistant(
|
||||
&self,
|
||||
project: &Project,
|
||||
issue_ref: IssueRef,
|
||||
profile: &AgentProfile,
|
||||
prepared: &PreparedContext,
|
||||
requester: &str,
|
||||
) -> Result<StructuredSessionEnvironment, RuntimeError>;
|
||||
}
|
||||
|
||||
/// Stores requester-scoped MCP tool policies for ephemeral assistant sessions.
|
||||
pub trait AgentToolPolicyStore: Send + Sync {
|
||||
/// Sets or replaces the policy for `requester`.
|
||||
|
||||
Reference in New Issue
Block a user