Au redémarrage, les agents qui étaient `working` lors de la fermeture restaient figés en statut fantôme `working` alors qu'aucun tour n'est plus en cours (bug reproductible en live : QA et DevBackend eux-mêmes sont restés `working` fantôme après leurs tâches). On réconcilie l'état persistant à l'ouverture du projet : les statuts orphelins sont ramenés à la cible `idle`. - domain/live_state.rs : const STALE_AT_RESTART_MARKER + `reconcile_orphans` (+ tests). - application/workstate/reconcile.rs (nouveau) : use case ReconcileLiveState (pas de nouveau port), best-effort, no-op si store vide (+ tests, dont empty_store_is_a_noop_at_boot). - application/workstate/mod.rs + lib.rs : module + re-export. - app-tauri/state.rs : provider par-root + champ AppState + wiring. - app-tauri/commands.rs : hook best-effort dans open_project. QA VERT par commande réelle : cargo test --workspace 1624 passed / 0 failed, cargo clippy --workspace --all-targets 0 erreur sur le code ajouté. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
136 lines
7.1 KiB
Rust
136 lines
7.1 KiB
Rust
//! # IdeA — Application layer
|
|
//!
|
|
//! Orchestrates **use cases** by talking **only to the domain ports** (traits),
|
|
//! never to concrete adapters (ARCHITECTURE §1.1, §6). Every use case is a
|
|
//! struct carrying its ports as `Arc<dyn Port>` and exposing
|
|
//! `execute(input) -> Result<output, AppError>`.
|
|
//!
|
|
//! This crate depends on `domain` only. The composition root (`app-tauri`) is
|
|
//! the single place that constructs concrete adapters and injects them here.
|
|
|
|
#![forbid(unsafe_code)]
|
|
#![warn(missing_docs)]
|
|
|
|
pub mod agent;
|
|
pub mod conversation;
|
|
pub mod diag;
|
|
pub mod embedder;
|
|
pub mod error;
|
|
pub mod git;
|
|
pub mod health;
|
|
pub mod layout;
|
|
pub mod memory;
|
|
pub mod orchestrator;
|
|
pub mod permission;
|
|
pub mod project;
|
|
pub mod remote;
|
|
pub mod skill;
|
|
pub mod template;
|
|
pub mod terminal;
|
|
pub mod window;
|
|
pub mod workstate;
|
|
|
|
pub use agent::{
|
|
drain_with_readiness, drain_with_readiness_outcome,
|
|
reference_profile_id, reference_profiles,
|
|
selectable_reference_profiles, send_blocking, AgentResumer, ChangeAgentProfile,
|
|
ChangeAgentProfileInput, ChangeAgentProfileOutput, ConfigureProfiles, ConfigureProfilesInput,
|
|
ConfigureProfilesOutput, CreateAgentFromScratch, CreateAgentInput, CreateAgentOutput,
|
|
DeleteAgent, DeleteAgentInput, DeleteProfile, DeleteProfileInput, DetectProfiles,
|
|
DetectProfilesInput, DetectProfilesOutput, FirstRunState, FirstRunStateOutput, HandoffProvider,
|
|
InjectedLiveRow, InspectConversation, InspectConversationInput, InspectConversationOutput,
|
|
LaunchAgent, LaunchAgentInput, LaunchAgentOutput, ListAgents, ListAgentsInput,
|
|
ListAgentsOutput, ListProfiles, ListProfilesOutput, ListResumableAgents,
|
|
ListResumableAgentsInput, ListResumableAgentsOutput, LiveStateLeanProvider, McpRuntime,
|
|
PermissionProjectorRegistry, ProfileAvailability, ProviderSessionProvider, ReadAgentContext,
|
|
ReadAgentContextInput, ReadAgentContextOutput, ReferenceProfiles, ReferenceProfilesOutput,
|
|
ResumableAgent, SaveProfile, SaveProfileInput, SaveProfileOutput, SessionLimitService,
|
|
StructuredSessionDescriptor, TurnOutcome, UpdateAgentContext, UpdateAgentContextInput,
|
|
AGENT_MEMORY_RECALL_BUDGET, CODEX_SUBMIT_DELAY_MS, LIVE_STATE_INJECT_MAX, RESUME_PROMPT,
|
|
};
|
|
pub use conversation::{
|
|
ConversationArchiveProvider, ReadConversationPage, ReadConversationPageInput, RecordTurn,
|
|
RotateConversationLog, RotateConversationLogInput, TurnPage, TurnSource, TurnView,
|
|
};
|
|
pub use embedder::{
|
|
CheckEmbedderSuggestion, CheckEmbedderSuggestionInput, CheckEmbedderSuggestionOutput,
|
|
DeleteEmbedderProfile, DeleteEmbedderProfileInput, DescribeEmbedderEngines, DismissChoice,
|
|
DismissEmbedderSuggestion, DismissEmbedderSuggestionInput, EmbedderEnginesView,
|
|
ListEmbedderProfiles, ListEmbedderProfilesOutput, OnnxModelView, SaveEmbedderProfile,
|
|
SaveEmbedderProfileInput, SaveEmbedderProfileOutput, SuggestedThisSession,
|
|
};
|
|
pub use error::AppError;
|
|
pub use git::{
|
|
GitBranches, GitBranchesInput, GitBranchesOutput, GitCheckout, GitCheckoutInput, GitCommit,
|
|
GitCommitInput, GitCommitOutput, GitGraph, GitGraphInput, GitGraphOutput, GitInit,
|
|
GitInitInput, GitLog, GitLogInput, GitLogOutput, GitStage, GitStagePathInput, GitStatus,
|
|
GitStatusInput, GitStatusOutput, GitUnstage,
|
|
};
|
|
pub use health::{HealthInput, HealthReport, HealthUseCase};
|
|
pub use layout::{
|
|
CreateLayout, CreateLayoutInput, CreateLayoutOutput, DeleteLayout, DeleteLayoutInput,
|
|
DeleteLayoutOutput, LayoutInfo, LayoutKind, LayoutOperation, LayoutsDoc, ListLayouts,
|
|
ListLayoutsInput, ListLayoutsOutput, LoadLayout, LoadLayoutInput, LoadLayoutOutput,
|
|
MutateLayout, MutateLayoutInput, MutateLayoutOutput, NamedLayout, ReconcileLayouts,
|
|
ReconcileLayoutsInput, ReconcileLayoutsOutput, RenameLayout, RenameLayoutInput,
|
|
SetActiveLayout, SetActiveLayoutInput, SnapshotRunningAgents, SnapshotRunningAgentsInput,
|
|
SnapshotRunningAgentsOutput, LAYOUTS_FILE,
|
|
};
|
|
pub use memory::{
|
|
CreateMemory, CreateMemoryInput, CreateMemoryOutput, DeleteMemory, DeleteMemoryInput,
|
|
GetMemory, GetMemoryInput, GetMemoryOutput, HarvestMemoryFromTurn, ListMemories,
|
|
ListMemoriesInput, ListMemoriesOutput, MemoryHarvestOutcome, ReadMemoryIndex,
|
|
ReadMemoryIndexInput, ReadMemoryIndexOutput, RecallMemory, RecallMemoryInput,
|
|
RecallMemoryOutput, ResolveMemoryLinks, ResolveMemoryLinksInput, ResolveMemoryLinksOutput,
|
|
UpdateMemory, UpdateMemoryInput, UpdateMemoryOutput,
|
|
};
|
|
pub use orchestrator::{
|
|
ContextGuardUseCases, LiveStateProvider, LiveStateReadProvider, McpRuntimeProvider,
|
|
OrchestratorOutcome, OrchestratorService, ProposeContext, ReadContext, ReadMemory,
|
|
RecordTurnProvider, WriteMemory,
|
|
};
|
|
pub use permission::{
|
|
GetProjectPermissions, GetProjectPermissionsInput, GetProjectPermissionsOutput,
|
|
ResolveAgentPermissions, ResolveAgentPermissionsInput, ResolveAgentPermissionsOutput,
|
|
UpdateAgentPermissions, UpdateAgentPermissionsInput, UpdateProjectPermissions,
|
|
UpdateProjectPermissionsInput,
|
|
};
|
|
pub use project::{
|
|
CloseProject, CloseProjectInput, CloseProjectOutput, CloseTab, CloseTabInput, CreateProject,
|
|
CreateProjectInput, CreateProjectOutput, ListProjects, ListProjectsOutput, OpenProject,
|
|
OpenProjectInput, OpenProjectOutput, ProjectMeta, ReadProjectContext, ReadProjectContextInput,
|
|
ReadProjectContextOutput, UpdateProjectContext, UpdateProjectContextInput,
|
|
PROJECT_CONTEXT_FILE,
|
|
};
|
|
pub use remote::{ConnectRemote, ConnectRemoteInput, ConnectRemoteOutput};
|
|
pub use skill::{
|
|
AssignSkillToAgent, AssignSkillToAgentInput, CreateSkill, CreateSkillInput, CreateSkillOutput,
|
|
DeleteSkill, DeleteSkillInput, ListSkills, ListSkillsInput, ListSkillsOutput, ReadSkill,
|
|
ReadSkillInput, UnassignSkillFromAgent, UnassignSkillFromAgentInput, UpdateSkill,
|
|
UpdateSkillInput, UpdateSkillOutput,
|
|
};
|
|
pub use template::{
|
|
AgentDrift, CreateAgentFromTemplate, CreateAgentFromTemplateInput,
|
|
CreateAgentFromTemplateOutput, CreateTemplate, CreateTemplateInput, CreateTemplateOutput,
|
|
DeleteTemplate, DeleteTemplateInput, DetectAgentDrift, DetectAgentDriftInput,
|
|
DetectAgentDriftOutput, ListTemplates, ListTemplatesOutput, SyncAgentWithTemplate,
|
|
SyncAgentWithTemplateInput, SyncAgentWithTemplateOutput, UpdateTemplate, UpdateTemplateInput,
|
|
UpdateTemplateOutput,
|
|
};
|
|
pub use terminal::{
|
|
CloseTerminal, CloseTerminalInput, CloseTerminalOutput, LiveAgentRegistry, LiveSessionKind,
|
|
LiveSessionSnapshot, LiveSessions, OpenTerminal, OpenTerminalInput, OpenTerminalOutput,
|
|
ResizeTerminal, ResizeTerminalInput, StructuredSessions, TerminalSessions, WriteToTerminal,
|
|
WriteToTerminalInput,
|
|
};
|
|
pub use window::{MoveTabToNewWindow, MoveTabToNewWindowInput, MoveTabToNewWindowOutput};
|
|
pub use workstate::{
|
|
AgentTicketState, AgentWorkState, AttachLiveAgent, AttachLiveAgentInput, AttachLiveAgentOutput,
|
|
ConversationLogProvider, ConversationPreviewStatus, ConversationTurnWorkPreview,
|
|
ConversationWorkSummary, GetLiveStateLean, GetProjectWorkState, GetProjectWorkStateInput,
|
|
LeanLiveEntry, LeanLiveState, LiveWorkSession, ProjectWorkState, ReconcileLiveState,
|
|
ReconcileLiveStateInput, StopLiveAgent, StopLiveAgentInput, StopLiveAgentOutput,
|
|
TicketWorkSource, TicketWorkStatus, UpdateLiveState, UpdateLiveStateInput,
|
|
LIVE_STATE_MAX_ENTRIES, LIVE_STATE_TTL_MS,
|
|
};
|