Files
IdeA/crates/application/src/lib.rs
Blomios 7007b2cc7e feat(backend,frontend): tâches planifiées projet — tool MCP idea_scheduled_task_* et menu utilisateur #305, fix transcript lié indisponible après reboot #314 (QA verte)
#305: nouvel agrégat durable ScheduledProjectTask dans domain (scheduled_task.rs, ids, ports ScheduledProjectTaskStore), source de vérité <app_data_dir>/scheduled-project-tasks/<projectId>.json, schedules bornés V1 interval/daily/weekly avec fuseau, cycle À approuver/Active/Suspendue avec approbation obligatoire des tâches demandées par agent; use cases application/scheduled_task (list/create/update/delete/run_now/reconcile/fire) réutilisant BackgroundTask pour les runs avec distinction planifié/manuel; store infrastructure dédié + scheduler reconcile au boot sans rattrapage en rafale, cwd confiné au projet; 7 tools MCP idea_scheduled_task_* (list/read lecture seule, create/update/delete/run_now/set_enabled write-actions soumises aux permissions natives); commandes Tauri + routes HTTP aux contrats DTO identiques (camelCase nextRunAtMs/lastRunAtMs/lastTaskId/createdBy/updatedBy); frontend: gateways Tauri/HTTP/mock + types ports/domain, surface projet 'Tâches planifiées' (liste utilisateur+agent unifiée, création/édition avec récapitulatif avant activation, approbation/refus, exécuter maintenant, suspendre/reprendre, suppression), catalogage surface web (webSurfaceCatalog/viewPlacement/ViewPanelBody/WebWorkspace); docs/scheduled-project-tasks.md et sdk docs/services.md (047c38b: pas un service plugin V1, pas d'émulation via cron système).

#314: correction de 'Conversation liée — transcript indisponible' après reboot: restauration du transcript lié côté application (orchestrator service, lifecycle, session_limit, background sink, terminal registry) et côté frontend (adapters agent/http frames/stream/requestResponse, workStateNormalization, CustomAgentChatView avec état et action utile), tests dto_chat/agent_lifecycle/structured_registry_d1/background_completion_sink étendus.

QA verte rapportée par QA sur feature/305-scheduled-project-tasks-mcp, sans bloquant, pour #305 et #314.

Hors périmètre worktree: tickets non liés, attachments/, scripts/; aucun push.
2026-09-11 10:32:01 +02:00

291 lines
16 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 background;
pub mod chat_attachments;
pub mod chat_drafts;
mod codex_permissions;
pub mod conversation;
pub mod device;
pub mod diag;
pub mod embedder;
pub mod error;
pub mod git;
pub mod health;
pub mod issues;
pub mod layout;
pub mod managed_temp;
pub mod mcp_tool_permissions;
pub mod memory;
pub mod model_server;
pub mod orchestrator;
pub mod permission;
pub mod plugin;
pub mod project;
pub mod project_plugin;
pub mod remote;
pub mod scheduled_task;
pub mod settings;
pub mod skill;
pub mod slash_command;
pub mod sprints;
pub mod system_permissions;
pub mod template;
pub mod terminal;
pub mod ticket_assistant;
pub mod window;
pub mod workstate;
pub use agent::{
claude_model_catalogue, codex_model_catalogue, drain_reply_stream_with_readiness,
drain_with_readiness, drain_with_readiness_and_announcements, drain_with_readiness_outcome,
reference_profile_id, reference_profiles, selectable_reference_profiles, send_blocking,
AgentResumer, AnnouncementPublisher, ChangeAgentProfile, ChangeAgentProfileInput,
ChangeAgentProfileOutput, CloneOpenCodeProfileFromSeed, CloneOpenCodeProfileFromSeedInput,
CloneOpenCodeProfileFromSeedOutput, CloneProfileFromSeed, CloneProfileFromSeedInput,
CloneProfileFromSeedOutput, 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, ListClaudeModels,
ListClaudeModelsOutput, ListCodexModels, ListCodexModelsOutput, ListOpenCodeProviders,
ListOpenCodeProvidersOutput, ListProfiles, ListProfilesOutput, ListResumableAgents,
ListResumableAgentsInput, ListResumableAgentsOutput, ListedAgentCapabilities,
LiveStateLeanProvider, ManagedTempExposureRequest, McpRuntime, OpenCodeProviderCatalogEntry,
PermissionProjectorRegistry, ProfileAvailability, ProfileModelCatalogEntry,
ProviderSessionProvider, ReadAgentContext, ReadAgentContextInput, ReadAgentContextOutput,
ReferenceProfiles, ReferenceProfilesOutput, ResumableAgent, SaveOpenCodeProviderProfile,
SaveOpenCodeProviderProfileInput, SaveOpenCodeProviderProfileOutput, SaveProfile,
SaveProfileInput, SaveProfileOutput, SessionLimitService, StructuredRoutingMode,
StructuredSessionDescriptor, TurnOutcome, UpdateAgentContactable, UpdateAgentContactableInput,
UpdateAgentContactableOutput, UpdateAgentContext, UpdateAgentContextInput, UpdateAgentEffort,
UpdateAgentEffortInput, UpdateAgentEffortOutput, UpdateProjectOrchestrator,
UpdateProjectOrchestratorInput, UpdateProjectOrchestratorOutput, AGENT_MEMORY_RECALL_BUDGET,
CODEX_SUBMIT_DELAY_MS, LIVE_STATE_INJECT_MAX, RESUME_PROMPT,
};
pub use background::{
BackgroundCommandArchive, CancelBackgroundTask, CancelBackgroundTaskOutput,
RetryBackgroundTask, SpawnBackgroundCommand, SpawnBackgroundCommandInput,
SpawnBackgroundCommandOutput,
};
pub use chat_attachments::{
ImportChatAttachmentItem, ImportChatAttachmentSource, ImportChatAttachments,
ImportChatAttachmentsInput, ImportChatAttachmentsOutput, CHAT_ATTACHMENT_MAX_BYTES,
};
pub use chat_drafts::{
ChatDraftScopeInput, ClearChatDraft, ReadChatDraft, ReadChatDraftOutput, SaveChatDraft,
SaveChatDraftInput,
};
pub use conversation::{
ConversationArchiveProvider, ReadConversationPage, ReadConversationPageInput, RecordTurn,
RotateConversationLog, RotateConversationLogInput, TurnPage, TurnSource, TurnView,
};
pub use device::{
normalize_pairing_code, pairing_codes_equal, AuthenticateSession, AuthenticateSessionInput,
DeviceView, ListDevices, ListDevicesInput, ListDevicesOutput, PairAttemptDecision,
PairAttemptLimiter, PairDevice, PairDeviceInput, PairDeviceOutput, RateLimitKey, RenameDevice,
RenameDeviceInput, RevokeAllDevices, RevokeDevice, RevokeDeviceInput, TouchDevice,
TouchDeviceInput, TouchDeviceOutput,
};
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 issues::{
AddIssueAttachment, AddIssueAttachmentInput, AddIssueAttachmentOutput, AssignIssueAgent,
AssignIssueAgentInput, AssignIssueAgentOutput, BatchIssueResult, BulkDeleteIssues,
BulkDeleteIssuesInput, BulkIssueMutationOutput, BulkUpdateIssuePriority,
BulkUpdateIssuePriorityInput, BulkUpdateIssueStatus, BulkUpdateIssueStatusInput, CreateIssue,
CreateIssueInput, CreateIssueOutput, DeleteIssue, DeleteIssueInput, DeleteIssueOutput,
LinkIssues, LinkIssuesInput, LinkIssuesOutput, ListIssues, ListIssuesInput, ListIssuesOutput,
MarkIssueAttachmentSummarized, MarkIssueAttachmentSummarizedInput,
MarkIssueAttachmentSummarizedOutput, ReadIssue, ReadIssueAttachment, ReadIssueAttachmentInput,
ReadIssueAttachmentOutput, ReadIssueCarnet, ReadIssueCarnetInput, ReadIssueCarnetOutput,
ReadIssueInput, ReadIssueOutput, UnlinkIssues, UnlinkIssuesInput, UpdateIssue,
UpdateIssueCarnet, UpdateIssueCarnetInput, UpdateIssueCarnetOutput, UpdateIssueInput,
UpdateIssueOutput, TICKET_ATTACHMENT_MAX_BYTES,
};
pub use layout::{
CreateLayout, CreateLayoutInput, CreateLayoutOutput, DeleteLayout, DeleteLayoutInput,
DeleteLayoutOutput, LayoutInfo, LayoutKind, LayoutOperation, LayoutsDoc, ListLayouts,
ListLayoutsInput, ListLayoutsOutput, LoadLayout, LoadLayoutInput, LoadLayoutOutput,
MutateLayout, MutateLayoutInput, MutateLayoutOutput, NamedLayout, PluginLayoutOrigin,
ReconcileLayouts, ReconcileLayoutsInput, ReconcileLayoutsOutput, RenameLayout,
RenameLayoutInput, SetActiveLayout, SetActiveLayoutInput, SetActiveLayoutOutput,
SnapshotRunningAgents, SnapshotRunningAgentsInput, SnapshotRunningAgentsOutput, LAYOUTS_FILE,
};
pub use managed_temp::{
AllocateManagedTemp, AllocateManagedTempInput, AllocateManagedTempOutput, GcManagedTemp,
GcManagedTempOutput, PurgeManagedTemp, PurgeManagedTempOutput, ReleaseManagedTemp,
ReleaseManagedTempInput, ReleaseManagedTempOutput, ResolveManagedTemp, ResolveManagedTempInput,
ResolveManagedTempOutput, MANAGED_TEMP_DEFAULT_TTL_MS, MANAGED_TEMP_PURPOSE_MAX_CHARS,
};
pub use mcp_tool_permissions::{
McpToolCatalogueAccess, McpToolCatalogueEntry, McpToolPermissionCatalogue,
ReadMcpToolPermissions, ReadMcpToolPermissionsInput, ReadMcpToolPermissionsOutput,
SetAgentMcpToolAllowed, SetAgentMcpToolAllowedInput, UpdateAgentMcpToolPermissions,
UpdateAgentMcpToolPermissionsInput, UpdateProjectMcpToolPermissions,
UpdateProjectMcpToolPermissionsInput,
};
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 model_server::{
model_server_error_code, DeleteModelArtifact, DeleteModelArtifactInput, DeleteModelServer,
DeleteModelServerInput, EnsureLocalModelServer, EnsureLocalModelServerInput,
EnsureLocalModelServerOutput, ListModelServers, ListModelServersOutput,
ModelArtifactDownloadTracker, ModelArtifactView, ModelServerListItem,
ReadinessPolicy as ModelServerReadinessPolicy, SaveModelServer, SaveModelServerInput,
SaveModelServerOutput,
};
pub use orchestrator::{
resolve_rendezvous_ceiling, resolve_rendezvous_window, run_inactivity_watchdog,
suspended_restart_continuation_prompt, AgentRestartScheduled, AgentSelfRestartScheduler,
AgentWakeService, AskLivenessProbe, ContextGuardUseCases, LiveStateProvider,
LiveStateReadProvider, McpRuntimeProvider, OrchestratorOutcome, OrchestratorService,
ProposeContext, ReadContext, ReadMemory, RecordTurnProvider, RestartContinuation,
RestartRendezvousCoordinator, RestartRendezvousRegistration, RestartRendezvousState,
WakeSessionProvider, WatchdogOutcome, WriteMemory, DEFAULT_RENDEZVOUS_CEILING,
DEFAULT_RENDEZVOUS_WINDOW, SELF_RESTART_CONTINUATION_PROMPT,
};
pub use permission::{
GetProjectPermissions, GetProjectPermissionsInput, GetProjectPermissionsOutput,
ResolveAgentPermissions, ResolveAgentPermissionsInput, ResolveAgentPermissionsOutput,
UpdateAgentPermissions, UpdateAgentPermissionsInput, UpdateProjectPermissions,
UpdateProjectPermissionsInput,
};
pub use plugin::{
InstallPluginFromArchive, InstallPluginFromDirectory, JsonPluginManifestValidator,
ListPluginRuntimeContributions, ListPlugins, PluginAdmin, PluginCommandTasks,
PluginConfigDocument, PluginConfigDocumentReadInput, PluginConfigDocumentUpdateInput,
PluginConfigDocumentWriteResult, PluginConfigDocuments, PluginContributionSummary,
PluginDiagnosticMessage, PluginEnvDiagnostic, PluginEnvRequirement, PluginEventBatch,
PluginEventPollInput, PluginEventSubscribeInput, PluginEventSubscription,
PluginEventSubscriptions, PluginEventUnsubscribeInput, PluginFileDiagnostic,
PluginFileRequirement, PluginInstallResult, PluginPublicEvent, PluginReloadResult,
PluginReview, PluginRunCommandInput, PluginRuntimeCatalog, PluginRuntimePlugin,
PluginStorageAccess, PluginStorageGetInput, PluginStorageSetInput, PluginTaskStatusInput,
PluginToolDiagnostic, PluginToolRequirement, PluginToolchainDiagnostic,
PluginToolchainDiagnosticInput, PluginToolchainDiagnostics, PluginWorkspaceAccess,
PluginWorkspaceBinaryFile, PluginWorkspaceDirEntry, PluginWorkspaceDirectoryListing,
PluginWorkspacePathInput, PluginWorkspaceStat, PluginWorkspaceTextFile,
PluginWorkspaceWriteBinaryInput, PluginWorkspaceWriteTextInput, ProjectConvention,
ProjectModule, ProjectStructureEntry, ProjectStructureQuery, QueryProjectStructure,
QueryProjectStructureInput, ReconcilePluginMcpServers, ReloadPlugin, ReloadPluginInput,
ReviewPluginPackage, ReviewPluginPackageInput, SetPluginEnabled, SetPluginEnabledInput,
UninstallPlugin, UninstallPluginInput, UninstallPluginResult,
};
pub use project::{
CloseProject, CloseProjectInput, CloseProjectOutput, CloseTab, CloseTabInput, CreateProject,
CreateProjectInput, CreateProjectOutput, ListProjectFiles, ListProjectFilesInput, ListProjects,
ListProjectsOutput, OpenProject, OpenProjectInput, OpenProjectOutput,
OpenProjectRestoreService, ProjectFileEntry, ProjectFileKind, ProjectFileListing, ProjectMeta,
ReadOpenProjectRestoreState, ReadProjectContext, ReadProjectContextInput,
ReadProjectContextOutput, RecordProjectClosedForRestore, RecordProjectOpenedForRestore,
RemoveProjectFromRegistry, RemoveProjectFromRegistryOutput, RemoveProjectFromRestore,
RestoreOpenProjectFailure, RestoreOpenProjects, RestoreOpenProjectsOutput,
RetryOpenProjectRestore, SaveOpenProjectRestoreOrder, UpdateProjectContext,
UpdateProjectContextInput, PROJECT_CONTEXT_FILE,
};
pub use project_plugin::{
plugin_skill_ref, plugin_tool_ref, AssignmentMutation, ListProjectPluginSettings,
MutateAgentPluginSkill, MutateAgentPluginTool, ProjectPluginResolver,
ProjectPluginSettingsView, SetProjectPluginEnabled,
};
pub use remote::{ConnectRemote, ConnectRemoteInput, ConnectRemoteOutput};
pub use scheduled_task::{
next_occurrence, CreateScheduledProjectTaskInput, ScheduledProjectTaskService,
UpdateScheduledProjectTaskInput,
};
pub use settings::{
ReadProjectSettings, ReadUserSettings, UpdateProjectSettings, UpdateUserSettings,
};
pub use skill::{
AgentCapability, AssignSkillToAgent, AssignSkillToAgentInput, AssignedSkillResolver,
CreateSkill, CreateSkillInput, CreateSkillOutput, DeleteSkill, DeleteSkillInput, ListSkills,
ListSkillsInput, ListSkillsOutput, ReadSkill, ReadSkillInput, ResolveAgentCapabilities,
ResolveAgentCapabilitiesInput, UnassignSkillFromAgent, UnassignSkillFromAgentInput,
UpdateSkill, UpdateSkillInput, UpdateSkillOutput,
};
pub use slash_command::{
plugin_slash_commands_from_runtime_catalog, ExecuteSlashCommand, ExecuteSlashCommandInput,
ExecuteSlashCommandOutput, ListSlashCommands, ListSlashCommandsInput, ListSlashCommandsOutput,
SlashCommandEffect, SlashCommandRegistry,
};
pub use sprints::{
normalized_reorder, AssignTicketToSprint, AssignTicketToSprintInput,
AssignTicketToSprintOutput, CreateSprint, CreateSprintInput, CreateSprintOutput, DeleteSprint,
DeleteSprintInput, ListSprints, ListSprintsInput, ListSprintsOutput, RenameSprint,
RenameSprintInput, ReorderSprints, ReorderSprintsInput, ReorderSprintsOutput, SprintListEntry,
SprintOutput, UnassignTicketFromSprint, UnassignTicketFromSprintInput,
};
pub use system_permissions::{
GetProjectSystemPermissions, GetProjectSystemPermissionsInput,
GetProjectSystemPermissionsOutput, ResolveAgentSystemPermissions,
ResolveAgentSystemPermissionsInput, ResolveAgentSystemPermissionsOutput,
UpdateAgentSystemPermissions, UpdateAgentSystemPermissionsInput,
UpdateProjectSystemPermissions, UpdateProjectSystemPermissionsInput,
};
pub use template::{
AgentDrift, CreateAgentFromTemplate, CreateAgentFromTemplateInput,
CreateAgentFromTemplateOutput, CreateTemplate, CreateTemplateInput, CreateTemplateOutput,
DeleteTemplate, DeleteTemplateInput, DetectAgentDrift, DetectAgentDriftInput,
DetectAgentDriftOutput, ListTemplates, ListTemplatesOutput, ReadTemplate, ReadTemplateInput,
ReadTemplateOutput, SyncAgentWithTemplate, SyncAgentWithTemplateInput,
SyncAgentWithTemplateOutput, UpdateTemplate, UpdateTemplateInput, UpdateTemplateOutput,
};
pub use terminal::{
CloseTerminal, CloseTerminalInput, CloseTerminalOutput, LiveAgentRegistry, LiveRuntimeState,
LiveRuntimeStatus, LiveSessionKind, LiveSessionSnapshot, LiveSessions, OpenTerminal,
OpenTerminalInput, OpenTerminalOutput, ResizeTerminal, ResizeTerminalInput, StructuredSessions,
TerminalSessions, WriteToTerminal, WriteToTerminalInput,
};
pub use ticket_assistant::{
CloseTicketAssistant, CloseTicketAssistantInput, OpenTicketAssistant, OpenTicketAssistantInput,
OpenTicketAssistantOutput,
};
pub use window::{
MoveTabToNewWindow, MoveTabToNewWindowInput, MoveTabToNewWindowOutput, OpenPluginLayoutWindow,
OpenPluginLayoutWindowInput, OpenPluginLayoutWindowOutput, RestoreOpenWindows,
RestoreOpenWindowsOutput, SnapshotOpenWindows, SnapshotOpenWindowsInput,
};
pub use workstate::{
AgentBackgroundTaskState, AgentTicketState, AgentWorkState, AppExitWorkGuardDetail,
AppExitWorkGuardState, AttachLiveAgent, AttachLiveAgentInput, AttachLiveAgentOutput,
BackgroundTaskKindLabel, ConversationLogProvider, ConversationPreviewStatus,
ConversationTurnWorkPreview, ConversationWorkSummary, GetAppExitWorkGuardState,
GetAppExitWorkGuardStateInput, GetLiveStateLean, GetProjectWorkState, GetProjectWorkStateInput,
LeanLiveEntry, LeanLiveState, LiveWorkSession, ProjectWorkState, ReconcileLiveState,
ReconcileLiveStateInput, StopAgentExecutionCascade, StopAgentRuntime, StopLiveAgent,
StopLiveAgentInput, StopLiveAgentOutput, TicketWorkSource, TicketWorkStatus, UpdateLiveState,
UpdateLiveStateInput, LIVE_STATE_MAX_ENTRIES, LIVE_STATE_TTL_MS,
};