-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask-config.yaml
More file actions
245 lines (211 loc) · 5.6 KB
/
task-config.yaml
File metadata and controls
245 lines (211 loc) · 5.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# dune Task Configuration Schema v1.0
# Standardowy plik konfiguracyjny dla zadań NLP
apiVersion: dune.io/v1
kind: TaskConfiguration
metadata:
name: imap-email-processor
description: "Pobieranie i organizacja wiadomości email z IMAP"
version: "1.0"
created: "2025-06-21T10:00:00Z"
tags:
- email
- imap
- data-processing
# Definicja zadania w języku naturalnym
task:
natural_language: |
Pobierz wszystkie wiadomości email ze skrzynki IMAP i zapisz je w folderach
uporządkowanych według roku i miesiąca w formacie skrzynka/rok.miesiąc/*.eml.
Dane logowania do skrzynki znajdziesz w pliku .env.
# Wymagania funkcjonalne
requirements:
- connect_to_imap_server
- download_all_emails
- organize_by_date
- save_as_eml_files
# Oczekiwany wynik
expected_output:
type: file_structure
pattern: "output/skrzynka/{year}.{month}/*.eml"
# Środowisko wykonawcze
runtime:
type: docker
base_image: python:3.11-slim
# Wymagane biblioteki Python
python_packages:
required:
- imaplib2>=3.6.0
- email-validator>=2.1.0
- python-dotenv>=1.0.0
- loguru>=0.7.2
optional:
- beautifulsoup4>=4.12.0 # dla parsowania HTML w emailach
- chardet>=5.2.0 # dla wykrywania kodowania
# Zmienne środowiskowe
environment:
required:
- IMAP_SERVER
- IMAP_USERNAME
- IMAP_PASSWORD
optional:
- IMAP_PORT
- IMAP_USE_SSL
- OUTPUT_DIR
# Usługi i zależności
services:
# Definicja usług wymaganych do zadania
dependencies:
- name: imap-server
type: imap
required: true
connection:
host: "${IMAP_SERVER}"
port: "${IMAP_PORT:-143}"
ssl: "${IMAP_USE_SSL:-false}"
health_check:
type: tcp_connect
timeout: 10s
- name: llm-analyzer
type: http_api
required: false # opcjonalne - fallback na domyślne szablony
connection:
url: "${OLLAMA_BASE_URL:-http://localhost:11434}"
model: "${OLLAMA_MODEL:-mistral:7b}"
health_check:
type: http_get
endpoint: "/api/tags"
timeout: 30s
# Usługi tworzone automatycznie (dla testów)
managed_services:
- name: test-imap-server
type: dovecot
enabled: "${ENABLE_TEST_SERVICES:-true}"
config:
users:
- username: testuser@example.com
password: testpass123
sample_emails: 5
ports:
- "143:143"
- name: ollama-llm
type: ollama
enabled: "${ENABLE_LLM:-true}"
config:
model: mistral:7b
ports:
- "11434:11434"
# Validation rules - walidacja przed wykonaniem
validation:
pre_execution:
# Sprawdź połączenie z usługami
- type: service_connectivity
services: [imap-server]
# Sprawdź zmienne środowiskowe
- type: environment_variables
required: [IMAP_SERVER, IMAP_USERNAME, IMAP_PASSWORD]
# Sprawdź uprawnienia do zapisu
- type: file_permissions
paths: ["${OUTPUT_DIR:-./output}"]
permissions: [read, write]
# Sprawdź dostępne miejsce na dysku
- type: disk_space
minimum: "100MB"
path: "${OUTPUT_DIR:-./output}"
post_execution:
# Sprawdź czy pliki zostały utworzone
- type: output_verification
expected_files:
pattern: "output/skrzynka/*/*.eml"
minimum_count: 1
# Sprawdź strukturę folderów
- type: directory_structure
expected:
- "output/skrzynka"
- "output/skrzynka/*/email_*.eml"
# Konfiguracja monitorowania i logowania
monitoring:
logs:
level: "${LOG_LEVEL:-INFO}"
destinations:
- type: file
path: "logs/task-execution.log"
- type: stdout
format: json
metrics:
- name: emails_processed
type: counter
description: "Liczba przetworzonych emaili"
- name: execution_time
type: histogram
description: "Czas wykonania zadania"
- name: errors_count
type: counter
description: "Liczba błędów podczas wykonania"
# Polityki bezpieczeństwa
security:
# Ograniczenia sieciowe
network:
allowed_outbound:
- host: "${IMAP_SERVER}"
ports: [143, 993]
- host: "${OLLAMA_BASE_URL}"
ports: [11434]
blocked_outbound:
- "*:22" # SSH
- "*:3389" # RDP
# Ograniczenia systemu plików
filesystem:
read_only_paths:
- "/etc"
- "/usr"
writable_paths:
- "${OUTPUT_DIR:-./output}"
- "/tmp"
- "logs/"
# Definicja pipeline'u
pipeline:
stages:
- name: validation
type: validation
config:
run_pre_execution_checks: true
- name: environment_setup
type: setup
config:
install_packages: true
create_directories: true
- name: llm_analysis
type: llm_processing
config:
analyze_natural_language: true
generate_code: true
fallback_to_templates: true
- name: task_execution
type: execution
config:
run_generated_code: true
capture_output: true
- name: post_validation
type: validation
config:
run_post_execution_checks: true
- name: cleanup
type: cleanup
config:
remove_temp_files: true
compress_logs: false
# Konfiguracja dla różnych środowisk
environments:
development:
managed_services_enabled: true
log_level: DEBUG
validation_strict: false
testing:
managed_services_enabled: true
log_level: INFO
validation_strict: true
production:
managed_services_enabled: false
log_level: WARNING
validation_strict: true
security_enhanced: true