- Added plugin base and loader for backend extensibility - Implemented application settings management with config persistence - Created Svelte-based frontend with Dashboard and Settings pages - Added API routes for plugins, tasks, and settings - Updated documentation and specifications - Improved project structure and developer tools
51 lines
1.9 KiB
Markdown
Executable File
51 lines
1.9 KiB
Markdown
Executable File
# Data Model: Plugin Architecture & Svelte Web UI
|
|
|
|
## Entities
|
|
|
|
### Plugin
|
|
Represents a loadable extension module.
|
|
|
|
| Field | Type | Description |
|
|
|-------|------|-------------|
|
|
| `id` | `str` | Unique identifier (e.g., "backup-tool") |
|
|
| `name` | `str` | Display name (e.g., "Backup Dashboard") |
|
|
| `description` | `str` | Short description of functionality |
|
|
| `version` | `str` | Plugin version string |
|
|
| `schema` | `dict` | JSON Schema for input parameters (generated from Pydantic) |
|
|
| `enabled` | `bool` | Whether the plugin is active |
|
|
|
|
### Task
|
|
Represents an execution instance of a plugin.
|
|
|
|
| Field | Type | Description |
|
|
|-------|------|-------------|
|
|
| `id` | `UUID` | Unique execution ID |
|
|
| `plugin_id` | `str` | ID of the plugin being executed |
|
|
| `status` | `Enum` | `PENDING`, `RUNNING`, `SUCCESS`, `FAILED` |
|
|
| `started_at` | `DateTime` | Timestamp when task started |
|
|
| `finished_at` | `DateTime` | Timestamp when task completed (nullable) |
|
|
| `user_id` | `str` | ID of the user who triggered the task |
|
|
| `logs` | `List[LogEntry]` | Structured logs from the execution |
|
|
|
|
### LogEntry
|
|
Represents a single log line from a task.
|
|
|
|
| Field | Type | Description |
|
|
|-------|------|-------------|
|
|
| `timestamp` | `DateTime` | Time of log event |
|
|
| `level` | `Enum` | `INFO`, `WARNING`, `ERROR`, `DEBUG` |
|
|
| `message` | `str` | Log content |
|
|
| `context` | `dict` | Additional metadata (optional) |
|
|
|
|
## State Transitions
|
|
|
|
### Task Lifecycle
|
|
1. **Created**: Task initialized with input parameters. Status: `PENDING`.
|
|
2. **Started**: Worker picks up task. Status: `RUNNING`.
|
|
3. **Completed**: Execution finishes without exception. Status: `SUCCESS`.
|
|
4. **Failed**: Execution raises unhandled exception. Status: `FAILED`.
|
|
|
|
## Validation Rules
|
|
|
|
- **Plugin ID**: Must be alphanumeric, lowercase, hyphens allowed.
|
|
- **Input Parameters**: Must validate against the plugin's `schema`. |