#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.
298 lines
12 KiB
Rust
298 lines
12 KiB
Rust
//! # IdeA — Domain layer
|
|
//!
|
|
//! The **pure** hexagonal core (ARCHITECTURE.md §1.4, §3, §4, §7). It contains:
|
|
//!
|
|
//! - **Entities & value objects** with invariants enforced by validating
|
|
//! constructors (`new`/`try_new` returning `Result`),
|
|
//! - the **pure layout logic** (`split`/`merge`/`resize`/`move` as immutable
|
|
//! `&LayoutTree -> Result<LayoutTree, LayoutError>` functions),
|
|
//! - **ports** (traits) the infrastructure implements,
|
|
//! - **domain events** and **errors**.
|
|
//!
|
|
//! ## Dependency rule
|
|
//!
|
|
//! This crate depends on **no I/O**: no `tokio`, no `std::fs`, no
|
|
//! `std::process`, no `git2`/`portable-pty`/`russh`. The only third-party
|
|
//! dependencies are `uuid`, `serde` (allowed solely to derive (de)serialisation
|
|
//! of *persisted* domain types — a metier format constraint, not I/O),
|
|
//! `thiserror`, and `async-trait`.
|
|
//!
|
|
//! ## Async strategy for ports
|
|
//!
|
|
//! I/O-touching ports (`PtyPort`, `FileSystem`, `ProcessSpawner`, `RemoteHost`,
|
|
//! the stores, `GitPort`) are `#[async_trait]`. They are injected as
|
|
//! `Arc<dyn Port>` trait objects at the composition root, which native
|
|
//! `async fn`-in-trait does not yet support dyn-compatibly without boxing;
|
|
//! `async_trait` boxes the returned future and keeps the ports object-safe.
|
|
//! Non-blocking ports (`Clock`, `IdGenerator`, `EventBus`, `AgentRuntime`)
|
|
//! remain plain synchronous traits. See [`ports`] for details.
|
|
|
|
#![forbid(unsafe_code)]
|
|
#![warn(missing_docs)]
|
|
|
|
pub mod agent;
|
|
pub mod agent_tool_policy;
|
|
pub mod background_task;
|
|
pub mod chat_attachment;
|
|
pub mod chat_draft;
|
|
pub mod conversation;
|
|
pub mod conversation_log;
|
|
pub mod device;
|
|
pub mod error;
|
|
pub mod events;
|
|
pub mod fileguard;
|
|
pub mod git;
|
|
pub mod ids;
|
|
pub mod inbox;
|
|
pub mod input;
|
|
pub mod issue;
|
|
pub mod layout;
|
|
pub mod live_state;
|
|
pub mod mailbox;
|
|
pub mod managed_temp;
|
|
pub mod markdown;
|
|
pub mod mcp_tool_permissions;
|
|
pub mod memory;
|
|
pub mod memory_harvest;
|
|
pub mod model_catalogue;
|
|
pub mod model_server;
|
|
pub mod orchestrator;
|
|
pub mod permission;
|
|
pub mod plugin;
|
|
pub mod ports;
|
|
pub mod profile;
|
|
pub mod project;
|
|
pub mod project_restore;
|
|
pub mod readiness;
|
|
pub mod remote;
|
|
pub mod sandbox;
|
|
pub mod scheduled_task;
|
|
pub mod session_limit;
|
|
pub mod settings;
|
|
pub mod skill;
|
|
pub mod slash_command;
|
|
pub mod sprint;
|
|
pub mod system_permissions;
|
|
pub mod template;
|
|
pub mod terminal;
|
|
|
|
mod validation;
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Curated re-exports for ergonomic downstream use.
|
|
// ---------------------------------------------------------------------------
|
|
|
|
pub use error::DomainError;
|
|
pub use events::RendezvousContext;
|
|
|
|
pub use ids::{
|
|
AgentId, IssueId, LayoutId, LocalModelServerId, NodeId, ProfileId, ProjectId, RendezvousId,
|
|
RuntimeAgentKey, ScheduleId, ScheduledTaskId, SessionId, SkillId, SprintId, TabId, TaskId,
|
|
TemplateId, WindowId,
|
|
};
|
|
|
|
pub use project::{Project, ProjectPath};
|
|
pub use project_restore::{
|
|
OpenProjectRestoreEntry, OpenProjectRestoreFailure, OpenProjectRestoreFailureCode,
|
|
OpenProjectRestoreState, OPEN_PROJECT_RESTORE_VERSION,
|
|
};
|
|
|
|
pub use agent::{Agent, AgentManifest, AgentOrigin, ManifestEntry};
|
|
|
|
pub use agent_tool_policy::AgentToolPolicy;
|
|
|
|
pub use mcp_tool_permissions::{
|
|
AgentMcpToolPolicyOverride, McpToolPermissionError, McpToolPolicy, ProjectMcpToolPermissions,
|
|
MCP_TOOL_PERMISSIONS_VERSION,
|
|
};
|
|
|
|
pub use background_task::{
|
|
BackgroundTask, BackgroundTaskError, BackgroundTaskKind, BackgroundTaskOrigin,
|
|
BackgroundTaskRendezvousLink, BackgroundTaskResult, BackgroundTaskState,
|
|
BackgroundTaskWakePolicy, BACKGROUND_TASK_LABEL_MAX_CHARS,
|
|
BACKGROUND_TASK_OUTPUT_TAIL_MAX_BYTES, BACKGROUND_TASK_TEXT_MAX_BYTES,
|
|
};
|
|
|
|
pub use chat_attachment::{
|
|
ChatAttachment, ChatAttachmentError, ChatAttachmentId, ChatAttachmentSourceKind,
|
|
};
|
|
pub use chat_draft::{ChatDraft, ChatDraftError, ChatDraftKey, CHAT_DRAFT_MAX_BYTES};
|
|
|
|
pub use skill::{Skill, SkillKind, SkillRef, SkillScope};
|
|
|
|
pub use slash_command::{
|
|
filter_slash_commands, native_slash_commands, plugin_slash_command, NativeSlashCommand,
|
|
PluginSlashCommandCallback, SlashCommand, SlashCommandAvailability, SlashCommandSource,
|
|
};
|
|
|
|
pub use template::{AgentTemplate, TemplateVersion};
|
|
|
|
pub use profile::{
|
|
resolve_effort, AgentProfile, ContextInjection, EffortOption, EffortSelection, EmbedderProfile,
|
|
EmbedderStrategy, LivenessStrategy, McpServerWiring, RateLimitPattern, SessionStrategy,
|
|
};
|
|
|
|
pub use mailbox::{
|
|
AgentMailbox, AgentQueueSnapshot, MailboxError, PendingReply, QueuedTicketSnapshot, Ticket,
|
|
TicketId,
|
|
};
|
|
pub use managed_temp::{
|
|
ManagedTempAllocation, ManagedTempError, ManagedTempGcReport, ManagedTempHandle,
|
|
ManagedTempKind, ManagedTempLease, ManagedTempState,
|
|
};
|
|
|
|
pub use conversation::{
|
|
Conversation, ConversationError, ConversationId, ConversationParty, ConversationRegistry,
|
|
ConversationSession, SessionRef, WaitForGraph,
|
|
};
|
|
|
|
pub use input::{AgentBusyState, AgentLiveness, InputMediator, InputSource};
|
|
|
|
pub use inbox::{
|
|
AgentInbox, AgentInboxSnapshot, InboxError, InboxItem, InboxItemKind, InboxReceipt,
|
|
InboxReceiptStatus, InboxSource, DEFAULT_AGENT_INBOX_CAPACITY,
|
|
};
|
|
|
|
pub use issue::{
|
|
AgentIssueRef, AgentIssueRole, Issue, IssueActor, IssueAttachment, IssueAttachmentId,
|
|
IssueCarnet, IssueError, IssueIndexEntry, IssueLink, IssueLinkKind, IssueListFilter,
|
|
IssueNumber, IssuePriority, IssueRef, IssueStatus, IssueVersion,
|
|
};
|
|
|
|
pub use sprint::{
|
|
validate_sprint_ordering, Sprint, SprintError, SprintIndexEntry, SprintOrder, SprintStatus,
|
|
SprintVersion,
|
|
};
|
|
|
|
pub use live_state::{LiveEntry, LiveState, WorkStatus, FIELD_MAX_BYTES, FIELD_PREVIEW_MAX_CHARS};
|
|
|
|
pub use readiness::{ReadinessPolicy, ReadinessSignal};
|
|
|
|
pub use session_limit::{plan_resume, RateLimitSource, ResumePlan, SessionLimit};
|
|
|
|
pub use conversation_log::{
|
|
bound_handoff_summary, clamp_page_limit, rotation_plan, ConversationArchive, ConversationLog,
|
|
ConversationTurn, Handoff, HandoffStore, HandoffSummarizer, PageCursor, PageDirection,
|
|
ProviderSessionStore, RotationDecision, RotationThresholds, SegmentStats, TurnId, TurnRole,
|
|
TurnSlice, HANDOFF_SUMMARY_MAX_CHARS, MAX_ARCHIVE_SEGMENTS, PAGE_DEFAULT_LIMIT, PAGE_MAX_LIMIT,
|
|
ROTATE_AFTER_BYTES, ROTATE_AFTER_TURNS,
|
|
};
|
|
|
|
pub use device::{
|
|
AuthenticatedDevice, DeviceError, DeviceId, DeviceName, PairedDevice, SessionTokenHash,
|
|
};
|
|
|
|
pub use fileguard::{
|
|
is_orchestrator, may_write_directly, FileGuard, GuardError, GuardedResource,
|
|
OrchestratorDesignation, ReadLease, WriteLease,
|
|
};
|
|
|
|
pub use markdown::MarkdownDoc;
|
|
|
|
pub use memory::{Memory, MemoryFrontmatter, MemoryIndexEntry, MemoryLink, MemorySlug, MemoryType};
|
|
|
|
pub use memory_harvest::{
|
|
parse_memory_directives, MemoryHarvestDirective, MemoryHarvestReport, MAX_BLOCKS,
|
|
MAX_BLOCK_BYTES, MAX_DESCRIPTION_CHARS,
|
|
};
|
|
|
|
pub use orchestrator::{
|
|
AssignedSkillSnapshot, OrchestrationCapabilitySnapshot,
|
|
ORCHESTRATION_CAPABILITY_SNAPSHOT_VERSION,
|
|
};
|
|
|
|
pub use model_catalogue::{
|
|
evaluate_compatibility, CliVersion, CompatibilityMatrix, ModelCatalogSource,
|
|
ModelCatalogueError, ModelCompatibility,
|
|
};
|
|
|
|
pub use model_server::{
|
|
validate_free_args, ExecutablePath, HfModelRef, LlamaCppOptions, LocalModelRef,
|
|
LocalModelServerConfig, LocalModelServerKind, ModelPath, ModelServerEndpoint,
|
|
ModelServerLifecycleStatus, ModelServerReady, ModelServerStatus, ModelSource, StopPolicy,
|
|
};
|
|
|
|
pub use remote::{RemoteKind, RemoteRef, SshAuth};
|
|
|
|
pub use terminal::{PtySize, SessionKind, SessionStatus, TerminalSession};
|
|
|
|
pub use git::GitRepository;
|
|
|
|
pub use layout::{
|
|
CustomPluginLayoutCell, Direction, GridCell, GridContainer, LayoutError, LayoutNode,
|
|
LayoutTree, LeafCell, PersistedMonitorState, PersistedPluginLayoutWindow, PersistedWindowKind,
|
|
PersistedWindowPosition, PersistedWindowSize, PersistedWindowState, PreferredView,
|
|
SplitContainer, Tab, WeightedChild, Window, WindowStateSnapshot, Workspace,
|
|
WINDOW_STATE_SNAPSHOT_VERSION,
|
|
};
|
|
|
|
pub use events::{DomainEvent, OrchestrationSource};
|
|
|
|
pub use permission::{
|
|
opencode_permission_block, render_permission_summary, resolve as resolve_permissions,
|
|
AgentPermissionOverride, Capability, CommandMatcher, CommandRule, Effect, EffectivePermissions,
|
|
Glob, PathScope, PermissionError, PermissionProjection, PermissionProjector, PermissionRule,
|
|
PermissionSet, PermissionShadowReport, Posture, ProjectPermissions, ProjectedFile,
|
|
ProjectionContext, ProjectorKey, PERMISSIONS_VERSION,
|
|
};
|
|
|
|
pub use system_permissions::{
|
|
resolve_agent_system_permissions, AgentSystemPermissionOverride, NetworkPolicy,
|
|
ProjectSystemPermissions, ResolvedAgentSystemPermissions, RuntimeLock, RuntimeLockState,
|
|
RuntimePermissionSnapshot, SystemPermissionControl, SystemPermissionControlMode,
|
|
SystemPermissionSet, SYSTEM_PERMISSIONS_VERSION,
|
|
};
|
|
|
|
pub use plugin::{
|
|
AgentPluginAssignments, ContentHash, CustomPluginLayout, PluginActivationScope,
|
|
PluginBundleUrl, PluginCapability, PluginCommandId, PluginContributionSet, PluginDescriptor,
|
|
PluginError, PluginId, PluginInstallSource, PluginLayoutContribution, PluginLayoutType,
|
|
PluginLifecycleState, PluginManifest, PluginMcpServerContribution, PluginMcpServerId,
|
|
PluginMcpServerSpec, PluginMcpStatus, PluginMcpStatusSet, PluginMcpToolMetadata,
|
|
PluginMenuItemContribution, PluginPackageRef, PluginRegistry, PluginRegistryEntry,
|
|
PluginSkillContribution, PluginSkillId, PluginSkillRef, PluginSlashCommandContribution,
|
|
PluginToolRef, PluginTopLevelMenuContribution, PluginTrustLevel, PluginVersion,
|
|
ProjectPluginActivation, ProjectPluginSettings, RelativePath, RemovalOutcome,
|
|
StagedPluginPackage,
|
|
};
|
|
|
|
pub use sandbox::{
|
|
compile_sandbox_plan, PathAccess, PathGrant, SandboxContext, SandboxEnforcer, SandboxError,
|
|
SandboxKind, SandboxPlan, SandboxStatus,
|
|
};
|
|
|
|
pub use scheduled_task::{
|
|
ScheduledProjectTask, ScheduledProjectTaskError, ScheduledTaskActor, ScheduledTaskApproval,
|
|
ScheduledTaskAuditEntry, ScheduledTaskCommand, ScheduledTaskSandbox, ScheduledTaskSchedule,
|
|
Weekday, MIN_SCHEDULE_INTERVAL_MINUTES,
|
|
};
|
|
|
|
pub use settings::{DefaultAgentTerminalInterface, IdeaUserSettings, ProjectSettings, ThemeColor};
|
|
|
|
pub use orchestrator::{
|
|
OrchestratorCommand, OrchestratorError, OrchestratorRequest, OrchestratorVisibility,
|
|
};
|
|
|
|
pub use ports::{
|
|
AgentContextStore, AgentRuntime, AgentToolPolicyStore, AssistantContextError,
|
|
AssistantContextProvider, BackgroundCompletionStream, BackgroundTaskCompletion,
|
|
BackgroundTaskHandle, BackgroundTaskPortError, BackgroundTaskRunner, BackgroundTaskSpec,
|
|
BackgroundTaskStore, CliVersionReader, Clock, CompatibilityMatrixSource, ContextInjectionPlan,
|
|
DirEntry, Embedder, EmbedderEnvInspector, EmbedderEnvReport, EmbedderError,
|
|
EmbedderProfileStore, EmbedderPromptDismissal, EmbedderPromptStore, EventBus, EventStream,
|
|
ExitStatus, FileSystem, FsError, GitCommitInfo, GitError, GitFileStatus, GitPort, GraphCommit,
|
|
IdGenerator, IssueAttachmentContent, IssueNumberAllocator, IssueStore, IssueStoreError,
|
|
LiveStateStore, LocalPath, McpToolPermissionStore, MemoryError, MemoryQuery, MemoryRecall,
|
|
MemoryStore, ModelArtifactCancel, ModelArtifactDownloader, ModelArtifactProgress,
|
|
ModelArtifactResolution, Output, OutputStream, PermissionStore, PluginManifestBytes,
|
|
PluginManifestError, PluginManifestValidator, PluginMcpError, PluginMcpSupervisor,
|
|
PluginPackageStore, PluginRegistryError, PluginRegistryStore, PluginStorageError,
|
|
PluginStorageStore, PluginStoreError, PreparedContext, ProcessError, ProcessSpawner,
|
|
ProfileStore, ProjectPluginSettingsStore, ProjectSettingsStore, ProjectStore,
|
|
ProviderModelCatalogue, PtyError, PtyHandle, PtyPort, RemoteError, RemoteHost, RemotePath,
|
|
RuntimeError, RuntimePermissionProbe, ScheduledProjectTaskStore, ScheduledTask,
|
|
ScheduledTaskStoreError, Scheduler, SpawnSpec, SprintStore, SprintStoreError, StoreError,
|
|
StructuredSessionEnvironment, StructuredSessionEnvironmentPreparer, SystemPermissionStore,
|
|
TemplateStore, UserSettingsStore, WindowStateStore,
|
|
};
|