feat(attachments): fondation pipeline durable d'attachments agent/chat + sandbox-safe (#154, QA verte)
Socle #154 : entité attachment, store, contrat DTO et routage session. Modules : domain/chat_attachment, application/chat_attachments, infrastructure/chat_attachments, app-tauri (commands/lib), backend dto.
This commit is contained in:
@ -34,6 +34,7 @@ use crate::agent_tool_policy::AgentToolPolicy;
|
||||
use crate::background_task::{
|
||||
BackgroundTask, BackgroundTaskKind, BackgroundTaskResult, BackgroundTaskWakePolicy,
|
||||
};
|
||||
use crate::chat_attachment::{ChatAttachment, ChatAttachmentId, ChatAttachmentSourceKind};
|
||||
use crate::device::{AuthenticatedDevice, DeviceId, PairedDevice};
|
||||
use crate::events::DomainEvent;
|
||||
use crate::ids::{
|
||||
@ -1066,6 +1067,57 @@ pub struct IssueAttachmentContent {
|
||||
pub bytes: Vec<u8>,
|
||||
}
|
||||
|
||||
/// Metadata supplied by a driving adapter when importing a chat attachment.
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct ChatAttachmentImport {
|
||||
/// Stable id allocated by the application layer.
|
||||
pub id: ChatAttachmentId,
|
||||
/// Original display filename.
|
||||
pub filename: String,
|
||||
/// MIME type.
|
||||
pub mime: String,
|
||||
/// Origin kind.
|
||||
pub source_kind: ChatAttachmentSourceKind,
|
||||
/// Creation time, epoch milliseconds.
|
||||
pub created_at: u64,
|
||||
}
|
||||
|
||||
/// Chat attachment store errors.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Error)]
|
||||
pub enum ChatAttachmentStoreError {
|
||||
/// The requested attachment does not exist.
|
||||
#[error("chat attachment not found")]
|
||||
NotFound,
|
||||
/// The attachment payload is invalid.
|
||||
#[error("chat attachment invalid: {0}")]
|
||||
Invalid(String),
|
||||
/// Store I/O or serialization failed.
|
||||
#[error("chat attachment store failed: {0}")]
|
||||
Store(String),
|
||||
}
|
||||
|
||||
/// Persistence port for project-scoped agent/chat attachments.
|
||||
#[async_trait]
|
||||
pub trait ChatAttachmentStore: Send + Sync {
|
||||
/// Copies a local source file into IdeA-managed durable attachment storage.
|
||||
async fn import_from_path(
|
||||
&self,
|
||||
root: &ProjectPath,
|
||||
project_id: ProjectId,
|
||||
agent_id: AgentId,
|
||||
session_id: SessionId,
|
||||
source: &LocalPath,
|
||||
import: ChatAttachmentImport,
|
||||
) -> Result<ChatAttachment, ChatAttachmentStoreError>;
|
||||
|
||||
/// Lists attachments imported for a structured/chat session.
|
||||
async fn list_for_session(
|
||||
&self,
|
||||
root: &ProjectPath,
|
||||
session_id: SessionId,
|
||||
) -> Result<Vec<ChatAttachment>, ChatAttachmentStoreError>;
|
||||
}
|
||||
|
||||
/// Errors from the sprint store.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Error)]
|
||||
pub enum SprintStoreError {
|
||||
|
||||
Reference in New Issue
Block a user