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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# =====================================================
|
| 2 |
+
# Apckeyl Framework
|
| 3 |
+
# CONTROL PLANE ARCHITECTURE
|
| 4 |
+
# Version 1.0
|
| 5 |
+
# =====================================================
|
| 6 |
+
|
| 7 |
+
# 1. Purpose
|
| 8 |
+
|
| 9 |
+
The Apckeyl Orchestrator is the central Control Plane
|
| 10 |
+
of the Apckeyl Framework.
|
| 11 |
+
|
| 12 |
+
The Orchestrator is responsible for coordination,
|
| 13 |
+
routing, task management, state tracking and communication
|
| 14 |
+
between independent processing modules.
|
| 15 |
+
|
| 16 |
+
The Orchestrator is NOT required to perform heavy
|
| 17 |
+
AI processing itself.
|
| 18 |
+
|
| 19 |
+
The framework therefore separates:
|
| 20 |
+
|
| 21 |
+
- Control Plane
|
| 22 |
+
- Compute Plane
|
| 23 |
+
|
| 24 |
+
This separation is a fundamental architectural principle
|
| 25 |
+
of the Apckeyl Framework.
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
# 2. Control Plane
|
| 29 |
+
|
| 30 |
+
The Control Plane contains the components responsible
|
| 31 |
+
for managing the system.
|
| 32 |
+
|
| 33 |
+
Primary responsibilities:
|
| 34 |
+
|
| 35 |
+
- receive tasks;
|
| 36 |
+
- validate tasks;
|
| 37 |
+
- create task records;
|
| 38 |
+
- assign task IDs;
|
| 39 |
+
- determine the required processing module;
|
| 40 |
+
- route tasks;
|
| 41 |
+
- monitor task state;
|
| 42 |
+
- handle errors;
|
| 43 |
+
- collect results;
|
| 44 |
+
- maintain logs;
|
| 45 |
+
- manage external Spaces and services;
|
| 46 |
+
- provide a unified interface for Telegram and other clients.
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
# 3. Compute Plane
|
| 50 |
+
|
| 51 |
+
The Compute Plane contains independent processing modules.
|
| 52 |
+
|
| 53 |
+
Compute modules perform the actual work.
|
| 54 |
+
|
| 55 |
+
Examples:
|
| 56 |
+
|
| 57 |
+
- Image Generation;
|
| 58 |
+
- Video Generation;
|
| 59 |
+
- Image Upscaler;
|
| 60 |
+
- Video Upscaler;
|
| 61 |
+
- Story Character Studio;
|
| 62 |
+
- Stock Factory;
|
| 63 |
+
- other AI processing services.
|
| 64 |
+
|
| 65 |
+
A Compute module should be independently replaceable.
|
| 66 |
+
|
| 67 |
+
The Orchestrator should not depend on the internal
|
| 68 |
+
implementation of a Compute module.
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
# 4. Core Principle
|
| 72 |
+
|
| 73 |
+
The fundamental relationship is:
|
| 74 |
+
|
| 75 |
+
CONTROL PLANE
|
| 76 |
+
|
|
| 77 |
+
v
|
| 78 |
+
ROUTING
|
| 79 |
+
|
|
| 80 |
+
v
|
| 81 |
+
COMPUTE MODULE
|
| 82 |
+
|
|
| 83 |
+
v
|
| 84 |
+
RESULT
|
| 85 |
+
|
|
| 86 |
+
v
|
| 87 |
+
CONTROL PLANE
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
The Orchestrator controls the task.
|
| 91 |
+
|
| 92 |
+
The external module performs the task.
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
# 5. Orchestrator Responsibilities
|
| 96 |
+
|
| 97 |
+
The Orchestrator may contain:
|
| 98 |
+
|
| 99 |
+
- Orchestrator Core;
|
| 100 |
+
- Task Manager;
|
| 101 |
+
- Queue Manager;
|
| 102 |
+
- Space Manager;
|
| 103 |
+
- Download Manager;
|
| 104 |
+
- Logger;
|
| 105 |
+
- Resource Monitor;
|
| 106 |
+
- Module Registry;
|
| 107 |
+
- API Gateway;
|
| 108 |
+
- configuration management.
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
# 6. Compute Module Responsibilities
|
| 112 |
+
|
| 113 |
+
A Compute Module should:
|
| 114 |
+
|
| 115 |
+
1. receive a valid request;
|
| 116 |
+
2. process the request;
|
| 117 |
+
3. produce a result;
|
| 118 |
+
4. return a status;
|
| 119 |
+
5. return an error when processing fails.
|
| 120 |
+
|
| 121 |
+
The Compute Module should not need to know
|
| 122 |
+
how the entire Apckeyl Framework is organized.
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
# 7. First Compute Module
|
| 126 |
+
|
| 127 |
+
The first production Compute Module connected to
|
| 128 |
+
the Control Plane is:
|
| 129 |
+
|
| 130 |
+
Apckeyl_RealESRGAN
|
| 131 |
+
|
| 132 |
+
Its purpose is image upscaling.
|
| 133 |
+
|
| 134 |
+
The existing Apckeyl_RealESRGAN Space remains an
|
| 135 |
+
independent processing Space.
|
| 136 |
+
|
| 137 |
+
It must NOT be replaced, deleted or moved as part
|
| 138 |
+
of the Control Plane migration.
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
# 8. Communication
|
| 142 |
+
|
| 143 |
+
The preferred communication model is:
|
| 144 |
+
|
| 145 |
+
Client
|
| 146 |
+
|
|
| 147 |
+
v
|
| 148 |
+
Orchestrator
|
| 149 |
+
|
|
| 150 |
+
v
|
| 151 |
+
Compute Module
|
| 152 |
+
|
|
| 153 |
+
v
|
| 154 |
+
Orchestrator
|
| 155 |
+
|
|
| 156 |
+
v
|
| 157 |
+
Client
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
Possible clients include:
|
| 161 |
+
|
| 162 |
+
- Telegram Bot;
|
| 163 |
+
- future web interface;
|
| 164 |
+
- internal tools;
|
| 165 |
+
- other Apckeyl services.
|
| 166 |
+
|
| 167 |
+
|
| 168 |
+
# 9. Telegram Integration
|
| 169 |
+
|
| 170 |
+
The Telegram Bot is treated as a client of the
|
| 171 |
+
Control Plane.
|
| 172 |
+
|
| 173 |
+
The Telegram Bot should not contain the complete
|
| 174 |
+
processing architecture.
|
| 175 |
+
|
| 176 |
+
Instead:
|
| 177 |
+
|
| 178 |
+
Telegram
|
| 179 |
+
|
|
| 180 |
+
v
|
| 181 |
+
ApckeylBot
|
| 182 |
+
|
|
| 183 |
+
v
|
| 184 |
+
Orchestrator
|
| 185 |
+
|
|
| 186 |
+
v
|
| 187 |
+
Compute Module
|
| 188 |
+
|
| 189 |
+
|
| 190 |
+
This allows the Telegram interface to remain
|
| 191 |
+
independent from the processing modules.
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
# 10. Module Registry
|
| 195 |
+
|
| 196 |
+
The Orchestrator should maintain a registry of
|
| 197 |
+
available Compute Modules.
|
| 198 |
+
|
| 199 |
+
Conceptually:
|
| 200 |
+
|
| 201 |
+
module_id
|
| 202 |
+
module_name
|
| 203 |
+
module_type
|
| 204 |
+
endpoint
|
| 205 |
+
status
|
| 206 |
+
capabilities
|
| 207 |
+
version
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
Example:
|
| 211 |
+
|
| 212 |
+
module_id:
|
| 213 |
+
realesrgan
|
| 214 |
+
|
| 215 |
+
module_name:
|
| 216 |
+
Apckeyl_RealESRGAN
|
| 217 |
+
|
| 218 |
+
module_type:
|
| 219 |
+
image_upscaler
|
| 220 |
+
|
| 221 |
+
status:
|
| 222 |
+
available
|
| 223 |
+
|
| 224 |
+
|
| 225 |
+
# 11. Task Routing
|
| 226 |
+
|
| 227 |
+
A task should contain enough information for the
|
| 228 |
+
Orchestrator to determine which module is required.
|
| 229 |
+
|
| 230 |
+
Example:
|
| 231 |
+
|
| 232 |
+
task_type:
|
| 233 |
+
image_upscale
|
| 234 |
+
|
| 235 |
+
The Orchestrator resolves:
|
| 236 |
+
|
| 237 |
+
image_upscale
|
| 238 |
+
|
|
| 239 |
+
v
|
| 240 |
+
realesrgan
|
| 241 |
+
|
|
| 242 |
+
v
|
| 243 |
+
Apckeyl_RealESRGAN
|
| 244 |
+
|
| 245 |
+
|
| 246 |
+
# 12. Task Independence
|
| 247 |
+
|
| 248 |
+
Tasks must not depend on the physical location
|
| 249 |
+
of a Compute Module.
|
| 250 |
+
|
| 251 |
+
The Compute Module may later be:
|
| 252 |
+
|
| 253 |
+
- a Hugging Face Space;
|
| 254 |
+
- another cloud service;
|
| 255 |
+
- an API;
|
| 256 |
+
- a local service;
|
| 257 |
+
- another compatible processing backend.
|
| 258 |
+
|
| 259 |
+
The Control Plane should remain unchanged whenever
|
| 260 |
+
possible.
|
| 261 |
+
|
| 262 |
+
|
| 263 |
+
# 13. Replaceable Compute Modules
|
| 264 |
+
|
| 265 |
+
A Compute Module is replaceable.
|
| 266 |
+
|
| 267 |
+
For example:
|
| 268 |
+
|
| 269 |
+
Apckeyl_RealESRGAN
|
| 270 |
+
|
|
| 271 |
+
v
|
| 272 |
+
Image Upscaler Module A
|
| 273 |
+
|
| 274 |
+
|
| 275 |
+
can later become:
|
| 276 |
+
|
| 277 |
+
Image Upscaler Module B
|
| 278 |
+
|
| 279 |
+
|
| 280 |
+
without redesigning the entire Orchestrator.
|
| 281 |
+
|
| 282 |
+
|
| 283 |
+
# 14. Failure Isolation
|
| 284 |
+
|
| 285 |
+
A failure of one Compute Module should not
|
| 286 |
+
automatically destroy the Control Plane.
|
| 287 |
+
|
| 288 |
+
Example:
|
| 289 |
+
|
| 290 |
+
Apckeyl_RealESRGAN
|
| 291 |
+
|
|
| 292 |
+
ERROR
|
| 293 |
+
|
|
| 294 |
+
X
|
| 295 |
+
|
| 296 |
+
The Orchestrator should remain operational.
|
| 297 |
+
|
| 298 |
+
The task should receive a failed state and an
|
| 299 |
+
appropriate error description.
|
| 300 |
+
|
| 301 |
+
|
| 302 |
+
# 15. ZeroGPU Consideration
|
| 303 |
+
|
| 304 |
+
The current Hugging Face Orchestrator Space may operate
|
| 305 |
+
under ZeroGPU limitations.
|
| 306 |
+
|
| 307 |
+
Therefore the framework must NOT depend on the
|
| 308 |
+
Orchestrator Space having permanent CPU or GPU compute
|
| 309 |
+
capacity.
|
| 310 |
+
|
| 311 |
+
The Control Plane must remain lightweight.
|
| 312 |
+
|
| 313 |
+
Heavy processing should be delegated to Compute Modules.
|
| 314 |
+
|
| 315 |
+
|
| 316 |
+
# 16. Hardware Independence
|
| 317 |
+
|
| 318 |
+
The Apckeyl Framework must not depend on the user's
|
| 319 |
+
personal computer as a permanent server.
|
| 320 |
+
|
| 321 |
+
The user's computer is a development and administration
|
| 322 |
+
environment only.
|
| 323 |
+
|
| 324 |
+
The production architecture should remain operational
|
| 325 |
+
without the user's old laptop.
|
| 326 |
+
|
| 327 |
+
|
| 328 |
+
# 17. Existing Working Spaces
|
| 329 |
+
|
| 330 |
+
Existing working Spaces should be preserved.
|
| 331 |
+
|
| 332 |
+
In particular:
|
| 333 |
+
|
| 334 |
+
Apckeyl_RealESRGAN
|
| 335 |
+
|
| 336 |
+
must remain an independent production module.
|
| 337 |
+
|
| 338 |
+
The Control Plane migration must not destroy or
|
| 339 |
+
rewrite existing working modules.
|
| 340 |
+
|
| 341 |
+
|
| 342 |
+
# 18. Future Architecture
|
| 343 |
+
|
| 344 |
+
The intended architecture is:
|
| 345 |
+
|
| 346 |
+
APCKEYL FRAMEWORK
|
| 347 |
+
|
|
| 348 |
+
v
|
| 349 |
+
+------------------+
|
| 350 |
+
| CONTROL PLANE |
|
| 351 |
+
| ORCHESTRATOR |
|
| 352 |
+
+--------+---------+
|
| 353 |
+
|
|
| 354 |
+
+-----------------+-----------------+
|
| 355 |
+
| | |
|
| 356 |
+
v v v
|
| 357 |
+
Image Factory Video Factory Stock Factory
|
| 358 |
+
| | |
|
| 359 |
+
v v v
|
| 360 |
+
Image Modules Video Modules Stock Modules
|
| 361 |
+
|
|
| 362 |
+
v
|
| 363 |
+
Apckeyl_RealESRGAN
|
| 364 |
+
|
| 365 |
+
|
| 366 |
+
# 19. Design Goal
|
| 367 |
+
|
| 368 |
+
The main design goal is:
|
| 369 |
+
|
| 370 |
+
One Control Plane.
|
| 371 |
+
Many independent Compute Modules.
|
| 372 |
+
|
| 373 |
+
|
| 374 |
+
The framework should allow new capabilities to be
|
| 375 |
+
added without rebuilding the entire system.
|
| 376 |
+
|
| 377 |
+
|
| 378 |
+
# 20. Development Strategy
|
| 379 |
+
|
| 380 |
+
Development should proceed incrementally.
|
| 381 |
+
|
| 382 |
+
Recommended order:
|
| 383 |
+
|
| 384 |
+
1. Control Plane architecture;
|
| 385 |
+
2. Orchestrator Core;
|
| 386 |
+
3. Module Registry;
|
| 387 |
+
4. Task Manager;
|
| 388 |
+
5. Space Manager;
|
| 389 |
+
6. communication layer;
|
| 390 |
+
7. first Compute Module integration;
|
| 391 |
+
8. Telegram integration;
|
| 392 |
+
9. additional Compute Modules;
|
| 393 |
+
10. Stock Factory;
|
| 394 |
+
11. Image Generation;
|
| 395 |
+
12. Video Generation;
|
| 396 |
+
13. Story Character Studio.
|
| 397 |
+
|
| 398 |
+
|
| 399 |
+
# 21. Architectural Rule
|
| 400 |
+
|
| 401 |
+
The following rule is mandatory:
|
| 402 |
+
|
| 403 |
+
ORCHESTRATOR = CONTROL
|
| 404 |
+
|
| 405 |
+
COMPUTE MODULE = WORK
|
| 406 |
+
|
| 407 |
+
|
| 408 |
+
The Orchestrator coordinates.
|
| 409 |
+
|
| 410 |
+
The Compute Module processes.
|
| 411 |
+
|
| 412 |
+
Neither component should unnecessarily assume
|
| 413 |
+
the responsibilities of the other.
|