llm-content-creator 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +309 -0
- package/dist/application/workflow/SyncExecutor.d.ts +75 -0
- package/dist/application/workflow/SyncExecutor.d.ts.map +1 -0
- package/dist/application/workflow/SyncExecutor.js +370 -0
- package/dist/application/workflow/SyncExecutor.js.map +1 -0
- package/dist/application/workflow/types.d.ts +46 -0
- package/dist/application/workflow/types.d.ts.map +1 -0
- package/dist/application/workflow/types.js +7 -0
- package/dist/application/workflow/types.js.map +1 -0
- package/dist/config/index.d.ts +173 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +288 -0
- package/dist/config/index.js.map +1 -0
- package/dist/domain/entities/QualityCheck.d.ts +181 -0
- package/dist/domain/entities/QualityCheck.d.ts.map +1 -0
- package/dist/domain/entities/QualityCheck.js +39 -0
- package/dist/domain/entities/QualityCheck.js.map +1 -0
- package/dist/domain/entities/Result.d.ts +103 -0
- package/dist/domain/entities/Result.d.ts.map +1 -0
- package/dist/domain/entities/Result.js +15 -0
- package/dist/domain/entities/Result.js.map +1 -0
- package/dist/domain/entities/Task.d.ts +130 -0
- package/dist/domain/entities/Task.d.ts.map +1 -0
- package/dist/domain/entities/Task.js +64 -0
- package/dist/domain/entities/Task.js.map +1 -0
- package/dist/domain/entities/TaskStep.d.ts +160 -0
- package/dist/domain/entities/TaskStep.d.ts.map +1 -0
- package/dist/domain/entities/TaskStep.js +30 -0
- package/dist/domain/entities/TaskStep.js.map +1 -0
- package/dist/domain/entities/TokenUsage.d.ts +70 -0
- package/dist/domain/entities/TokenUsage.d.ts.map +1 -0
- package/dist/domain/entities/TokenUsage.js +42 -0
- package/dist/domain/entities/TokenUsage.js.map +1 -0
- package/dist/domain/entities/index.d.ts +11 -0
- package/dist/domain/entities/index.d.ts.map +1 -0
- package/dist/domain/entities/index.js +16 -0
- package/dist/domain/entities/index.js.map +1 -0
- package/dist/domain/repositories/QualityCheckRepository.d.ts +49 -0
- package/dist/domain/repositories/QualityCheckRepository.d.ts.map +1 -0
- package/dist/domain/repositories/QualityCheckRepository.js +5 -0
- package/dist/domain/repositories/QualityCheckRepository.js.map +1 -0
- package/dist/domain/repositories/ResultRepository.d.ts +43 -0
- package/dist/domain/repositories/ResultRepository.d.ts.map +1 -0
- package/dist/domain/repositories/ResultRepository.js +5 -0
- package/dist/domain/repositories/ResultRepository.js.map +1 -0
- package/dist/domain/repositories/TaskRepository.d.ts +240 -0
- package/dist/domain/repositories/TaskRepository.d.ts.map +1 -0
- package/dist/domain/repositories/TaskRepository.js +7 -0
- package/dist/domain/repositories/TaskRepository.js.map +1 -0
- package/dist/domain/workflow/CheckpointManager.d.ts +94 -0
- package/dist/domain/workflow/CheckpointManager.d.ts.map +1 -0
- package/dist/domain/workflow/CheckpointManager.js +224 -0
- package/dist/domain/workflow/CheckpointManager.js.map +1 -0
- package/dist/domain/workflow/ContentCreatorGraph.d.ts +17 -0
- package/dist/domain/workflow/ContentCreatorGraph.d.ts.map +1 -0
- package/dist/domain/workflow/ContentCreatorGraph.js +381 -0
- package/dist/domain/workflow/ContentCreatorGraph.js.map +1 -0
- package/dist/domain/workflow/State.d.ts +172 -0
- package/dist/domain/workflow/State.d.ts.map +1 -0
- package/dist/domain/workflow/State.js +184 -0
- package/dist/domain/workflow/State.js.map +1 -0
- package/dist/domain/workflow/index.d.ts +11 -0
- package/dist/domain/workflow/index.d.ts.map +1 -0
- package/dist/domain/workflow/index.js +15 -0
- package/dist/domain/workflow/index.js.map +1 -0
- package/dist/domain/workflow/nodes/BaseNode.d.ts +134 -0
- package/dist/domain/workflow/nodes/BaseNode.d.ts.map +1 -0
- package/dist/domain/workflow/nodes/BaseNode.js +253 -0
- package/dist/domain/workflow/nodes/BaseNode.js.map +1 -0
- package/dist/domain/workflow/nodes/CheckImageNode.d.ts +43 -0
- package/dist/domain/workflow/nodes/CheckImageNode.d.ts.map +1 -0
- package/dist/domain/workflow/nodes/CheckImageNode.js +254 -0
- package/dist/domain/workflow/nodes/CheckImageNode.js.map +1 -0
- package/dist/domain/workflow/nodes/CheckTextNode.d.ts +66 -0
- package/dist/domain/workflow/nodes/CheckTextNode.d.ts.map +1 -0
- package/dist/domain/workflow/nodes/CheckTextNode.js +530 -0
- package/dist/domain/workflow/nodes/CheckTextNode.js.map +1 -0
- package/dist/domain/workflow/nodes/GenerateImageNode.d.ts +44 -0
- package/dist/domain/workflow/nodes/GenerateImageNode.d.ts.map +1 -0
- package/dist/domain/workflow/nodes/GenerateImageNode.js +272 -0
- package/dist/domain/workflow/nodes/GenerateImageNode.js.map +1 -0
- package/dist/domain/workflow/nodes/OrganizeNode.d.ts +49 -0
- package/dist/domain/workflow/nodes/OrganizeNode.d.ts.map +1 -0
- package/dist/domain/workflow/nodes/OrganizeNode.js +241 -0
- package/dist/domain/workflow/nodes/OrganizeNode.js.map +1 -0
- package/dist/domain/workflow/nodes/SearchNode.d.ts +48 -0
- package/dist/domain/workflow/nodes/SearchNode.d.ts.map +1 -0
- package/dist/domain/workflow/nodes/SearchNode.js +151 -0
- package/dist/domain/workflow/nodes/SearchNode.js.map +1 -0
- package/dist/domain/workflow/nodes/WriteNode.d.ts +68 -0
- package/dist/domain/workflow/nodes/WriteNode.d.ts.map +1 -0
- package/dist/domain/workflow/nodes/WriteNode.js +431 -0
- package/dist/domain/workflow/nodes/WriteNode.js.map +1 -0
- package/dist/domain/workflow/nodes/config/index.js +287 -0
- package/dist/domain/workflow/nodes/domain/entities/Task.js +68 -0
- package/dist/domain/workflow/nodes/domain/workflow/State.js +200 -0
- package/dist/domain/workflow/nodes/domain/workflow/nodes/BaseNode.js +328 -0
- package/dist/domain/workflow/nodes/domain/workflow/nodes/CheckTextNode.js +500 -0
- package/dist/domain/workflow/nodes/index.d.ts +13 -0
- package/dist/domain/workflow/nodes/index.d.ts.map +1 -0
- package/dist/domain/workflow/nodes/index.js +13 -0
- package/dist/domain/workflow/nodes/index.js.map +1 -0
- package/dist/domain/workflow/nodes/infrastructure/logging/logger.js +275 -0
- package/dist/domain/workflow/nodes/services/llm/EnhancedLLMService.js +559 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/infrastructure/cache/CacheService.d.ts +139 -0
- package/dist/infrastructure/cache/CacheService.d.ts.map +1 -0
- package/dist/infrastructure/cache/CacheService.js +419 -0
- package/dist/infrastructure/cache/CacheService.js.map +1 -0
- package/dist/infrastructure/cache/index.d.ts +5 -0
- package/dist/infrastructure/cache/index.d.ts.map +1 -0
- package/dist/infrastructure/cache/index.js +6 -0
- package/dist/infrastructure/cache/index.js.map +1 -0
- package/dist/infrastructure/database/BaseRepository.d.ts +98 -0
- package/dist/infrastructure/database/BaseRepository.d.ts.map +1 -0
- package/dist/infrastructure/database/BaseRepository.js +178 -0
- package/dist/infrastructure/database/BaseRepository.js.map +1 -0
- package/dist/infrastructure/database/MemoryTaskRepository.d.ts +77 -0
- package/dist/infrastructure/database/MemoryTaskRepository.d.ts.map +1 -0
- package/dist/infrastructure/database/MemoryTaskRepository.js +309 -0
- package/dist/infrastructure/database/MemoryTaskRepository.js.map +1 -0
- package/dist/infrastructure/database/PostgresQualityCheckRepository.d.ts +36 -0
- package/dist/infrastructure/database/PostgresQualityCheckRepository.d.ts.map +1 -0
- package/dist/infrastructure/database/PostgresQualityCheckRepository.js +89 -0
- package/dist/infrastructure/database/PostgresQualityCheckRepository.js.map +1 -0
- package/dist/infrastructure/database/PostgresTaskRepository.d.ts +94 -0
- package/dist/infrastructure/database/PostgresTaskRepository.d.ts.map +1 -0
- package/dist/infrastructure/database/PostgresTaskRepository.js +364 -0
- package/dist/infrastructure/database/PostgresTaskRepository.js.map +1 -0
- package/dist/infrastructure/database/ResultRepository.d.ts +41 -0
- package/dist/infrastructure/database/ResultRepository.d.ts.map +1 -0
- package/dist/infrastructure/database/ResultRepository.js +86 -0
- package/dist/infrastructure/database/ResultRepository.js.map +1 -0
- package/dist/infrastructure/database/SQLiteTaskRepository.d.ts +101 -0
- package/dist/infrastructure/database/SQLiteTaskRepository.d.ts.map +1 -0
- package/dist/infrastructure/database/SQLiteTaskRepository.js +548 -0
- package/dist/infrastructure/database/SQLiteTaskRepository.js.map +1 -0
- package/dist/infrastructure/database/index.d.ts +32 -0
- package/dist/infrastructure/database/index.d.ts.map +1 -0
- package/dist/infrastructure/database/index.js +72 -0
- package/dist/infrastructure/database/index.js.map +1 -0
- package/dist/infrastructure/logging/logger.d.ts +69 -0
- package/dist/infrastructure/logging/logger.d.ts.map +1 -0
- package/dist/infrastructure/logging/logger.js +169 -0
- package/dist/infrastructure/logging/logger.js.map +1 -0
- package/dist/infrastructure/monitoring/LoggingService.d.ts +109 -0
- package/dist/infrastructure/monitoring/LoggingService.d.ts.map +1 -0
- package/dist/infrastructure/monitoring/LoggingService.js +198 -0
- package/dist/infrastructure/monitoring/LoggingService.js.map +1 -0
- package/dist/infrastructure/monitoring/MetricsService.d.ts +112 -0
- package/dist/infrastructure/monitoring/MetricsService.d.ts.map +1 -0
- package/dist/infrastructure/monitoring/MetricsService.js +362 -0
- package/dist/infrastructure/monitoring/MetricsService.js.map +1 -0
- package/dist/infrastructure/monitoring/SentryService.d.ts +108 -0
- package/dist/infrastructure/monitoring/SentryService.d.ts.map +1 -0
- package/dist/infrastructure/monitoring/SentryService.js +282 -0
- package/dist/infrastructure/monitoring/SentryService.js.map +1 -0
- package/dist/infrastructure/monitoring/index.d.ts +7 -0
- package/dist/infrastructure/monitoring/index.d.ts.map +1 -0
- package/dist/infrastructure/monitoring/index.js +10 -0
- package/dist/infrastructure/monitoring/index.js.map +1 -0
- package/dist/infrastructure/queue/TaskQueue.d.ts +110 -0
- package/dist/infrastructure/queue/TaskQueue.d.ts.map +1 -0
- package/dist/infrastructure/queue/TaskQueue.js +363 -0
- package/dist/infrastructure/queue/TaskQueue.js.map +1 -0
- package/dist/infrastructure/queue/index.d.ts +5 -0
- package/dist/infrastructure/queue/index.d.ts.map +1 -0
- package/dist/infrastructure/queue/index.js +5 -0
- package/dist/infrastructure/queue/index.js.map +1 -0
- package/dist/infrastructure/redis/connection.d.ts +61 -0
- package/dist/infrastructure/redis/connection.d.ts.map +1 -0
- package/dist/infrastructure/redis/connection.js +184 -0
- package/dist/infrastructure/redis/connection.js.map +1 -0
- package/dist/infrastructure/redis/index.d.ts +5 -0
- package/dist/infrastructure/redis/index.d.ts.map +1 -0
- package/dist/infrastructure/redis/index.js +5 -0
- package/dist/infrastructure/redis/index.js.map +1 -0
- package/dist/infrastructure/security/ApiKeyService.d.ts +103 -0
- package/dist/infrastructure/security/ApiKeyService.d.ts.map +1 -0
- package/dist/infrastructure/security/ApiKeyService.js +250 -0
- package/dist/infrastructure/security/ApiKeyService.js.map +1 -0
- package/dist/infrastructure/security/QuotaService.d.ts +87 -0
- package/dist/infrastructure/security/QuotaService.d.ts.map +1 -0
- package/dist/infrastructure/security/QuotaService.js +303 -0
- package/dist/infrastructure/security/QuotaService.js.map +1 -0
- package/dist/infrastructure/security/RateLimiter.d.ts +104 -0
- package/dist/infrastructure/security/RateLimiter.d.ts.map +1 -0
- package/dist/infrastructure/security/RateLimiter.js +331 -0
- package/dist/infrastructure/security/RateLimiter.js.map +1 -0
- package/dist/infrastructure/security/index.d.ts +7 -0
- package/dist/infrastructure/security/index.d.ts.map +1 -0
- package/dist/infrastructure/security/index.js +10 -0
- package/dist/infrastructure/security/index.js.map +1 -0
- package/dist/monitoring/index.d.ts +5 -0
- package/dist/monitoring/index.d.ts.map +1 -0
- package/dist/monitoring/index.js +5 -0
- package/dist/monitoring/index.js.map +1 -0
- package/dist/monitoring/server.d.ts +14 -0
- package/dist/monitoring/server.d.ts.map +1 -0
- package/dist/monitoring/server.js +99 -0
- package/dist/monitoring/server.js.map +1 -0
- package/dist/presentation/cli/commands/cancel.d.ts +8 -0
- package/dist/presentation/cli/commands/cancel.d.ts.map +1 -0
- package/dist/presentation/cli/commands/cancel.js +57 -0
- package/dist/presentation/cli/commands/cancel.js.map +1 -0
- package/dist/presentation/cli/commands/create.d.ts +8 -0
- package/dist/presentation/cli/commands/create.d.ts.map +1 -0
- package/dist/presentation/cli/commands/create.js +368 -0
- package/dist/presentation/cli/commands/create.js.map +1 -0
- package/dist/presentation/cli/commands/result.d.ts +8 -0
- package/dist/presentation/cli/commands/result.d.ts.map +1 -0
- package/dist/presentation/cli/commands/result.js +121 -0
- package/dist/presentation/cli/commands/result.js.map +1 -0
- package/dist/presentation/cli/commands/status.d.ts +8 -0
- package/dist/presentation/cli/commands/status.d.ts.map +1 -0
- package/dist/presentation/cli/commands/status.js +92 -0
- package/dist/presentation/cli/commands/status.js.map +1 -0
- package/dist/presentation/cli/index.d.ts +8 -0
- package/dist/presentation/cli/index.d.ts.map +1 -0
- package/dist/presentation/cli/index.js +32 -0
- package/dist/presentation/cli/index.js.map +1 -0
- package/dist/presentation/cli/utils/cleanup.d.ts +14 -0
- package/dist/presentation/cli/utils/cleanup.d.ts.map +1 -0
- package/dist/presentation/cli/utils/cleanup.js +62 -0
- package/dist/presentation/cli/utils/cleanup.js.map +1 -0
- package/dist/presentation/cli/utils/formatter.d.ts +28 -0
- package/dist/presentation/cli/utils/formatter.d.ts.map +1 -0
- package/dist/presentation/cli/utils/formatter.js +68 -0
- package/dist/presentation/cli/utils/formatter.js.map +1 -0
- package/dist/presentation/cli.d.ts +7 -0
- package/dist/presentation/cli.d.ts.map +1 -0
- package/dist/presentation/cli.js +8 -0
- package/dist/presentation/cli.js.map +1 -0
- package/dist/presentation/monitor-cli.d.ts +8 -0
- package/dist/presentation/monitor-cli.d.ts.map +1 -0
- package/dist/presentation/monitor-cli.js +44 -0
- package/dist/presentation/monitor-cli.js.map +1 -0
- package/dist/presentation/worker-cli.d.ts +8 -0
- package/dist/presentation/worker-cli.d.ts.map +1 -0
- package/dist/presentation/worker-cli.js +51 -0
- package/dist/presentation/worker-cli.js.map +1 -0
- package/dist/schedulers/TaskScheduler.d.ts +99 -0
- package/dist/schedulers/TaskScheduler.d.ts.map +1 -0
- package/dist/schedulers/TaskScheduler.js +233 -0
- package/dist/schedulers/TaskScheduler.js.map +1 -0
- package/dist/schedulers/index.d.ts +5 -0
- package/dist/schedulers/index.d.ts.map +1 -0
- package/dist/schedulers/index.js +5 -0
- package/dist/schedulers/index.js.map +1 -0
- package/dist/services/image/ImageService.d.ts +68 -0
- package/dist/services/image/ImageService.d.ts.map +1 -0
- package/dist/services/image/ImageService.js +166 -0
- package/dist/services/image/ImageService.js.map +1 -0
- package/dist/services/index.d.ts +8 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +12 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/llm/EnhancedLLMService.d.ts +148 -0
- package/dist/services/llm/EnhancedLLMService.d.ts.map +1 -0
- package/dist/services/llm/EnhancedLLMService.js +425 -0
- package/dist/services/llm/EnhancedLLMService.js.map +1 -0
- package/dist/services/llm/LLMService.d.ts +103 -0
- package/dist/services/llm/LLMService.d.ts.map +1 -0
- package/dist/services/llm/LLMService.js +212 -0
- package/dist/services/llm/LLMService.js.map +1 -0
- package/dist/services/quality/HardRuleChecker.d.ts +143 -0
- package/dist/services/quality/HardRuleChecker.d.ts.map +1 -0
- package/dist/services/quality/HardRuleChecker.js +353 -0
- package/dist/services/quality/HardRuleChecker.js.map +1 -0
- package/dist/services/quality/LLMEvaluator.d.ts +105 -0
- package/dist/services/quality/LLMEvaluator.d.ts.map +1 -0
- package/dist/services/quality/LLMEvaluator.js +312 -0
- package/dist/services/quality/LLMEvaluator.js.map +1 -0
- package/dist/services/quality/QualityCheckService.d.ts +112 -0
- package/dist/services/quality/QualityCheckService.d.ts.map +1 -0
- package/dist/services/quality/QualityCheckService.js +342 -0
- package/dist/services/quality/QualityCheckService.js.map +1 -0
- package/dist/services/quality/QualityService.d.ts +75 -0
- package/dist/services/quality/QualityService.d.ts.map +1 -0
- package/dist/services/quality/QualityService.js +360 -0
- package/dist/services/quality/QualityService.js.map +1 -0
- package/dist/services/quality/index.d.ts +7 -0
- package/dist/services/quality/index.d.ts.map +1 -0
- package/dist/services/quality/index.js +10 -0
- package/dist/services/quality/index.js.map +1 -0
- package/dist/services/search/SearchService.d.ts +79 -0
- package/dist/services/search/SearchService.d.ts.map +1 -0
- package/dist/services/search/SearchService.js +193 -0
- package/dist/services/search/SearchService.js.map +1 -0
- package/dist/workers/TaskWorker.d.ts +61 -0
- package/dist/workers/TaskWorker.d.ts.map +1 -0
- package/dist/workers/TaskWorker.js +256 -0
- package/dist/workers/TaskWorker.js.map +1 -0
- package/dist/workers/index.d.ts +5 -0
- package/dist/workers/index.d.ts.map +1 -0
- package/dist/workers/index.js +5 -0
- package/dist/workers/index.js.map +1 -0
- package/docs/DOCUMENTATION-ANALYSIS.md +190 -0
- package/docs/README.md +145 -0
- package/docs/SOURCE-CODE-ANALYSIS.md +1107 -0
- package/docs/architecture-complete.md +5524 -0
- package/docs/archive/implementation/implementation-analysis/README.md +244 -0
- package/docs/archive/implementation/implementation-analysis/implementation-analysis-context.md +483 -0
- package/docs/archive/implementation/implementation-analysis/implementation-analysis-plan.md +1242 -0
- package/docs/archive/implementation/implementation-analysis/implementation-analysis-tasks.md +777 -0
- package/docs/archive/phases/phase-1/phase-1-completion-summary.md +284 -0
- package/docs/archive/phases/phase-1/phase-1-implementation-guide.md +1380 -0
- package/docs/archive/phases/phase-2/phase-2a/phase-2a-completion-summary.md +443 -0
- package/docs/archive/phases/phase-2/phase-2b/phase-2b-completion-report.md +430 -0
- package/docs/archive/phases/phase-2/phase-2b/phase-2b-completion-summary.md +592 -0
- package/docs/archive/phases/phase-2/phase-2b/phase-2b-final-summary.md +371 -0
- package/docs/archive/phases/phase-2/phase-2b/phase-2b-preparation-complete.md +343 -0
- package/docs/archive/phases/phase-2/phase-2b/phase-2b-preparation.md +945 -0
- package/docs/archive/phases/phase-2/phase-2b/phase-2b-progress-update.md +366 -0
- package/docs/archive/phases/phase-3/phase-3-completion-summary.md +354 -0
- package/docs/archive/phases/phase-3/phase-3-development-plan.md +878 -0
- package/docs/archive/phases/phase-3/phase-3-quick-start.md +324 -0
- package/docs/archive/phases/phase-4/phase-4-completion-summary.md +708 -0
- package/docs/archive/phases/phase-4/phase-4-development-plan.md +740 -0
- package/docs/archive/phases/phase-4/phase-4-quick-start.md +632 -0
- package/docs/archive/phases/phase-4/phase-4-session-3-security-testing.md +484 -0
- package/docs/archive/phases/phase-4/phase-4-session-4-unit-tests.md +550 -0
- package/docs/archive/phases/phase-4/phase-4-session-5-security-tests.md +564 -0
- package/docs/archive/phases/phase-4/phase-4-session-6-cache-integration.md +456 -0
- package/docs/archive/phases/phase-4/phase-4-session-7-test-fixes.md +348 -0
- package/docs/archive/phases/phase-4/phase-4-session-8-taskqueue-fixes.md +323 -0
- package/docs/archive/phases/phase-4/phase-4-session-summary-continued.md +373 -0
- package/docs/archive/phases/phase-4/phase-4-session-summary.md +595 -0
- package/docs/archive/reports/progress-reports/PHASE_0_PROGRESS.md +242 -0
- package/docs/archive/reports/progress-reports/PHASE_0_SUMMARY.md +262 -0
- package/docs/archive/reports/progress-reports/PHASE_1_2_ISSUES.md +399 -0
- package/docs/archive/reports/progress-reports/PHASE_1_PROGRESS.md +388 -0
- package/docs/archive/reports/progress-reports/PHASE_3_PREPARATION.md +574 -0
- package/docs/archive/reports/progress-reports/current-progress-update.md +294 -0
- package/docs/archive/reports/progress-reports/final-summary.md +215 -0
- package/docs/archive/reports/progress-reports/implementation-summary.md +287 -0
- package/docs/archive/reports/progress-reports/project-progress-report.md +440 -0
- package/docs/archive/reports/progress-reports/project-progress.md +386 -0
- package/docs/archive/reports/test-reports/TEST-COVERAGE-REPORT.md +441 -0
- package/docs/archive/reports/test-reports/e2e-test-report.md +293 -0
- package/docs/archive/reports/test-reports/final-test-report.md +367 -0
- package/docs/archive/reports/test-reports/real-env-test-report.md +391 -0
- package/docs/archive/reports/test-reports/test-completion-summary.md +356 -0
- package/docs/archive/reports/test-reports/test-report.md +371 -0
- package/docs/archive/sessions/session-2-summary.md +429 -0
- package/docs/archive/sessions/session-3-summary.md +395 -0
- package/docs/archive/sessions/session-summary.md +370 -0
- package/docs/config-system-update.md +239 -0
- package/docs/database-refactoring-PLAN.md +199 -0
- package/docs/database-refactoring-SUMMARY.md +384 -0
- package/docs/quality-check-architecture.md +1030 -0
- package/docs/quick-start.md +388 -0
- package/docs/references/bullmq-quick-reference.md +525 -0
- package/docs/references/monitoring-optimization-guide.md +871 -0
- package/docs/references/performance-optimization-guide.md +933 -0
- package/docs/storage-guide.md +612 -0
- package/docs/test-implementation-PLAN.md +223 -0
- package/docs/test-implementation-SUMMARY.md +194 -0
- package/docs/user-guide.md +719 -0
- package/docs/workflow-architecture.md +549 -0
- package/package.json +126 -0
- package/src/application/workflow/SyncExecutor.ts +444 -0
- package/src/application/workflow/types.ts +57 -0
- package/src/config/index.ts +352 -0
- package/src/domain/entities/QualityCheck.ts +202 -0
- package/src/domain/entities/Result.ts +130 -0
- package/src/domain/entities/Task.ts +178 -0
- package/src/domain/entities/TaskStep.ts +188 -0
- package/src/domain/entities/TokenUsage.ts +119 -0
- package/src/domain/entities/index.ts +20 -0
- package/src/domain/repositories/QualityCheckRepository.ts +52 -0
- package/src/domain/repositories/ResultRepository.ts +47 -0
- package/src/domain/repositories/TaskRepository.ts +271 -0
- package/src/domain/workflow/CheckpointManager.ts +283 -0
- package/src/domain/workflow/ContentCreatorGraph.ts +446 -0
- package/src/domain/workflow/State.ts +321 -0
- package/src/domain/workflow/index.ts +18 -0
- package/src/domain/workflow/nodes/BaseNode.ts +325 -0
- package/src/domain/workflow/nodes/CheckImageNode.ts +325 -0
- package/src/domain/workflow/nodes/CheckTextNode.ts +709 -0
- package/src/domain/workflow/nodes/GenerateImageNode.ts +342 -0
- package/src/domain/workflow/nodes/OrganizeNode.ts +304 -0
- package/src/domain/workflow/nodes/SearchNode.ts +192 -0
- package/src/domain/workflow/nodes/WriteNode.ts +505 -0
- package/src/domain/workflow/nodes/index.ts +13 -0
- package/src/index.ts +43 -0
- package/src/infrastructure/cache/CacheService.ts +483 -0
- package/src/infrastructure/cache/index.ts +6 -0
- package/src/infrastructure/database/BaseRepository.ts +214 -0
- package/src/infrastructure/database/MemoryTaskRepository.ts +377 -0
- package/src/infrastructure/database/PostgresQualityCheckRepository.ts +115 -0
- package/src/infrastructure/database/PostgresTaskRepository.ts +424 -0
- package/src/infrastructure/database/ResultRepository.ts +113 -0
- package/src/infrastructure/database/SQLiteTaskRepository.ts +651 -0
- package/src/infrastructure/database/index.ts +83 -0
- package/src/infrastructure/logging/logger.ts +231 -0
- package/src/infrastructure/monitoring/LoggingService.ts +292 -0
- package/src/infrastructure/monitoring/MetricsService.ts +468 -0
- package/src/infrastructure/monitoring/SentryService.ts +345 -0
- package/src/infrastructure/monitoring/index.ts +12 -0
- package/src/infrastructure/queue/TaskQueue.ts +429 -0
- package/src/infrastructure/queue/index.ts +5 -0
- package/src/infrastructure/redis/connection.ts +215 -0
- package/src/infrastructure/redis/index.ts +5 -0
- package/src/infrastructure/security/ApiKeyService.ts +340 -0
- package/src/infrastructure/security/QuotaService.ts +411 -0
- package/src/infrastructure/security/RateLimiter.ts +417 -0
- package/src/infrastructure/security/index.ts +12 -0
- package/src/monitoring/index.ts +5 -0
- package/src/monitoring/server.ts +109 -0
- package/src/presentation/cli/commands/cancel.ts +64 -0
- package/src/presentation/cli/commands/create.ts +400 -0
- package/src/presentation/cli/commands/result.ts +136 -0
- package/src/presentation/cli/commands/status.ts +102 -0
- package/src/presentation/cli/index.ts +39 -0
- package/src/presentation/cli/utils/cleanup.ts +65 -0
- package/src/presentation/cli/utils/formatter.ts +74 -0
- package/src/presentation/cli.ts +8 -0
- package/src/presentation/monitor-cli.ts +52 -0
- package/src/presentation/worker-cli.ts +62 -0
- package/src/schedulers/TaskScheduler.ts +314 -0
- package/src/schedulers/index.ts +11 -0
- package/src/services/image/ImageService.ts +221 -0
- package/src/services/index.ts +15 -0
- package/src/services/llm/EnhancedLLMService.ts +596 -0
- package/src/services/llm/LLMService.ts +310 -0
- package/src/services/quality/HardRuleChecker.ts +509 -0
- package/src/services/quality/LLMEvaluator.ts +400 -0
- package/src/services/quality/QualityCheckService.ts +473 -0
- package/src/services/quality/QualityService.ts +445 -0
- package/src/services/quality/index.ts +12 -0
- package/src/services/search/SearchService.ts +266 -0
- package/src/types/global.d.ts +17 -0
- package/src/workers/TaskWorker.ts +320 -0
- package/src/workers/index.ts +5 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResultRepository.d.ts","sourceRoot":"","sources":["../../../src/domain/repositories/ResultRepository.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;IACzC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IACrC,SAAS,EAAE,IAAI,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAElD;;OAEG;IACH,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;IAEtD;;OAEG;IACH,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResultRepository.js","sourceRoot":"","sources":["../../../src/domain/repositories/ResultRepository.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TaskRepository 接口
|
|
3
|
+
*
|
|
4
|
+
* 定义任务数据访问层的契约
|
|
5
|
+
*/
|
|
6
|
+
import type { Task } from '../entities/Task.js';
|
|
7
|
+
import { TaskStatus, ExecutionMode } from '../entities/Task.js';
|
|
8
|
+
export type { Task };
|
|
9
|
+
/**
|
|
10
|
+
* 创建任务输入参数
|
|
11
|
+
*/
|
|
12
|
+
export interface CreateTaskInput {
|
|
13
|
+
id?: string;
|
|
14
|
+
userId?: string;
|
|
15
|
+
mode: ExecutionMode;
|
|
16
|
+
topic: string;
|
|
17
|
+
requirements: string;
|
|
18
|
+
hardConstraints?: {
|
|
19
|
+
minWords?: number;
|
|
20
|
+
maxWords?: number;
|
|
21
|
+
keywords?: string[];
|
|
22
|
+
};
|
|
23
|
+
idempotencyKey?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 查询任务列表的过滤器
|
|
27
|
+
*/
|
|
28
|
+
export interface TaskFilter {
|
|
29
|
+
userId?: string;
|
|
30
|
+
status?: TaskStatus;
|
|
31
|
+
mode?: ExecutionMode;
|
|
32
|
+
startDate?: Date;
|
|
33
|
+
endDate?: Date;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* 分页参数
|
|
37
|
+
*/
|
|
38
|
+
export interface Pagination {
|
|
39
|
+
limit?: number;
|
|
40
|
+
offset?: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* 分页结果
|
|
44
|
+
*/
|
|
45
|
+
export interface PaginatedResult<T> {
|
|
46
|
+
data: T[];
|
|
47
|
+
total: number;
|
|
48
|
+
limit: number;
|
|
49
|
+
offset: number;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* 创建任务参数(简化版本,用于 SQLite/Memory Repository)
|
|
53
|
+
*/
|
|
54
|
+
export interface TaskCreateParams {
|
|
55
|
+
id: string;
|
|
56
|
+
traceId?: string;
|
|
57
|
+
mode: string;
|
|
58
|
+
type: string;
|
|
59
|
+
topic: string;
|
|
60
|
+
requirements: string;
|
|
61
|
+
hardConstraints?: any;
|
|
62
|
+
maxRetries?: number;
|
|
63
|
+
priority?: number;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* 更新任务参数(简化版本,用于 SQLite/Memory Repository)
|
|
67
|
+
*/
|
|
68
|
+
export interface TaskUpdateParams {
|
|
69
|
+
status?: string;
|
|
70
|
+
currentStep?: string;
|
|
71
|
+
errorMessage?: string;
|
|
72
|
+
retryCount?: number;
|
|
73
|
+
workerId?: string;
|
|
74
|
+
startedAt?: string;
|
|
75
|
+
completedAt?: string;
|
|
76
|
+
version?: number;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* 任务列表过滤器(简化版本,用于 SQLite/Memory Repository)
|
|
80
|
+
*/
|
|
81
|
+
export interface TaskListFilters {
|
|
82
|
+
status?: string;
|
|
83
|
+
workerId?: string;
|
|
84
|
+
type?: string;
|
|
85
|
+
limit?: number;
|
|
86
|
+
offset?: number;
|
|
87
|
+
sortBy?: string;
|
|
88
|
+
sortOrder?: 'ASC' | 'DESC';
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* TaskRepository 接口
|
|
92
|
+
*/
|
|
93
|
+
export interface ITaskRepository {
|
|
94
|
+
/**
|
|
95
|
+
* 创建任务
|
|
96
|
+
*
|
|
97
|
+
* @param input - 创建任务输入参数
|
|
98
|
+
* @returns 创建的任务
|
|
99
|
+
*/
|
|
100
|
+
create(input: CreateTaskInput): Promise<Task>;
|
|
101
|
+
/**
|
|
102
|
+
* 根据 taskId 查询任务
|
|
103
|
+
*
|
|
104
|
+
* @param taskId - 任务 ID
|
|
105
|
+
* @returns 任务或 null
|
|
106
|
+
*/
|
|
107
|
+
findById(taskId: string): Promise<Task | null>;
|
|
108
|
+
/**
|
|
109
|
+
* 根据 idempotencyKey 查询任务
|
|
110
|
+
*
|
|
111
|
+
* @param idempotencyKey - 幂等键
|
|
112
|
+
* @returns 任务或 null
|
|
113
|
+
*/
|
|
114
|
+
findByIdempotencyKey(idempotencyKey: string): Promise<Task | null>;
|
|
115
|
+
/**
|
|
116
|
+
* 根据 userId 查询任务列表
|
|
117
|
+
*
|
|
118
|
+
* @param userId - 用户 ID
|
|
119
|
+
* @param pagination - 分页参数
|
|
120
|
+
* @returns 任务列表
|
|
121
|
+
*/
|
|
122
|
+
findByUserId(userId: string, pagination?: Pagination): Promise<Task[]>;
|
|
123
|
+
/**
|
|
124
|
+
* 查询任务列表(支持过滤和分页)
|
|
125
|
+
*
|
|
126
|
+
* @param filter - 过滤条件
|
|
127
|
+
* @param pagination - 分页参数
|
|
128
|
+
* @returns 任务列表
|
|
129
|
+
*/
|
|
130
|
+
findMany(filter?: TaskFilter, pagination?: Pagination): Promise<Task[]>;
|
|
131
|
+
/**
|
|
132
|
+
* 统计任务数量
|
|
133
|
+
*
|
|
134
|
+
* @param filter - 过滤条件
|
|
135
|
+
* @returns 任务数量
|
|
136
|
+
*/
|
|
137
|
+
count(filter?: TaskFilter): Promise<number>;
|
|
138
|
+
/**
|
|
139
|
+
* 更新任务状态(带乐观锁)
|
|
140
|
+
*
|
|
141
|
+
* @param taskId - 任务 ID
|
|
142
|
+
* @param status - 新状态
|
|
143
|
+
* @param version - 当前版本号
|
|
144
|
+
* @returns 是否更新成功
|
|
145
|
+
*/
|
|
146
|
+
updateStatus(taskId: string, status: TaskStatus, version: number): Promise<boolean>;
|
|
147
|
+
/**
|
|
148
|
+
* 更新当前步骤(带乐观锁)
|
|
149
|
+
*
|
|
150
|
+
* @param taskId - 任务 ID
|
|
151
|
+
* @param step - 当前步骤名称
|
|
152
|
+
* @param version - 当前版本号
|
|
153
|
+
* @returns 是否更新成功
|
|
154
|
+
*/
|
|
155
|
+
updateCurrentStep(taskId: string, step: string, version: number): Promise<boolean>;
|
|
156
|
+
/**
|
|
157
|
+
* Worker 抢占任务(乐观锁)
|
|
158
|
+
*
|
|
159
|
+
* 只有状态为 pending 且版本号匹配的任务才能被抢占
|
|
160
|
+
*
|
|
161
|
+
* @param taskId - 任务 ID
|
|
162
|
+
* @param workerId - Worker ID
|
|
163
|
+
* @param version - 当前版本号
|
|
164
|
+
* @returns 是否抢占成功
|
|
165
|
+
*/
|
|
166
|
+
claimTask(taskId: string, workerId: string, version: number): Promise<boolean>;
|
|
167
|
+
/**
|
|
168
|
+
* 增加重试计数(带乐观锁)
|
|
169
|
+
*
|
|
170
|
+
* @param taskId - 任务 ID
|
|
171
|
+
* @param type - 重试类型(text/image)
|
|
172
|
+
* @param version - 当前版本号
|
|
173
|
+
* @returns 是否更新成功
|
|
174
|
+
*/
|
|
175
|
+
incrementRetryCount(taskId: string, type: 'text' | 'image', version: number): Promise<boolean>;
|
|
176
|
+
/**
|
|
177
|
+
* 保存 State 快照(带乐观锁)
|
|
178
|
+
*
|
|
179
|
+
* @param taskId - 任务 ID
|
|
180
|
+
* @param snapshot - State 快照对象
|
|
181
|
+
* @param version - 当前版本号
|
|
182
|
+
* @returns 是否更新成功
|
|
183
|
+
*/
|
|
184
|
+
saveStateSnapshot(taskId: string, snapshot: object, version: number): Promise<boolean>;
|
|
185
|
+
/**
|
|
186
|
+
* 标记任务完成(带乐观锁)
|
|
187
|
+
*
|
|
188
|
+
* @param taskId - 任务 ID
|
|
189
|
+
* @param version - 当前版本号
|
|
190
|
+
* @returns 是否更新成功
|
|
191
|
+
*/
|
|
192
|
+
markAsCompleted(taskId: string, version: number): Promise<boolean>;
|
|
193
|
+
/**
|
|
194
|
+
* 标记任务失败(带乐观锁)
|
|
195
|
+
*
|
|
196
|
+
* @param taskId - 任务 ID
|
|
197
|
+
* @param errorMessage - 错误信息
|
|
198
|
+
* @param version - 当前版本号
|
|
199
|
+
* @returns 是否更新成功
|
|
200
|
+
*/
|
|
201
|
+
markAsFailed(taskId: string, errorMessage: string, version: number): Promise<boolean>;
|
|
202
|
+
/**
|
|
203
|
+
* 释放 Worker 占用(用于任务崩溃时)
|
|
204
|
+
*
|
|
205
|
+
* @param taskId - 任务 ID
|
|
206
|
+
* @param workerId - Worker ID(用于验证)
|
|
207
|
+
* @param version - 当前版本号
|
|
208
|
+
* @returns 是否释放成功
|
|
209
|
+
*/
|
|
210
|
+
releaseWorker(taskId: string, workerId: string, version: number): Promise<boolean>;
|
|
211
|
+
/**
|
|
212
|
+
* 软删除任务
|
|
213
|
+
*
|
|
214
|
+
* @param taskId - 任务 ID
|
|
215
|
+
* @returns 是否删除成功
|
|
216
|
+
*/
|
|
217
|
+
softDelete(taskId: string): Promise<boolean>;
|
|
218
|
+
/**
|
|
219
|
+
* 永久删除任务
|
|
220
|
+
*
|
|
221
|
+
* @param taskId - 任务 ID
|
|
222
|
+
* @returns 是否删除成功
|
|
223
|
+
*/
|
|
224
|
+
delete(taskId: string): Promise<boolean>;
|
|
225
|
+
/**
|
|
226
|
+
* 获取待处理任务队列(用于 Worker 获取任务)
|
|
227
|
+
*
|
|
228
|
+
* @param limit - 获取数量限制
|
|
229
|
+
* @returns 待处理任务列表
|
|
230
|
+
*/
|
|
231
|
+
getPendingTasks(limit?: number): Promise<Task[]>;
|
|
232
|
+
/**
|
|
233
|
+
* 获取 Worker 的活跃任务
|
|
234
|
+
*
|
|
235
|
+
* @param workerId - Worker ID
|
|
236
|
+
* @returns 活跃任务列表
|
|
237
|
+
*/
|
|
238
|
+
getActiveTasksByWorker(workerId: string): Promise<Task[]>;
|
|
239
|
+
}
|
|
240
|
+
//# sourceMappingURL=TaskRepository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TaskRepository.d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EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEtF;;;;;;;OAOG;IACH,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEnF;;;;;OAKG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE7C;;;;;OAKG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEzC;;;;;OAKG;IACH,eAAe,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IAEjD;;;;;OAKG;IACH,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;CAC3D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TaskRepository.js","sourceRoot":"","sources":["../../../src/domain/repositories/TaskRepository.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CheckpointManager - 检查点管理器
|
|
3
|
+
*
|
|
4
|
+
* 负责工作流状态的保存和恢复:
|
|
5
|
+
* - 每个 Node 执行完成后保存 State 到数据库
|
|
6
|
+
* - 崩溃后从数据库恢复 State
|
|
7
|
+
* - 支持断点续传
|
|
8
|
+
*/
|
|
9
|
+
import type { WorkflowState } from './State.js';
|
|
10
|
+
import { PostgresTaskRepository } from '../../infrastructure/database/PostgresTaskRepository.js';
|
|
11
|
+
/**
|
|
12
|
+
* 检查点信息
|
|
13
|
+
*/
|
|
14
|
+
export interface Checkpoint {
|
|
15
|
+
taskId: string;
|
|
16
|
+
stepName: string;
|
|
17
|
+
state: Partial<WorkflowState>;
|
|
18
|
+
timestamp: Date;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* 检查点管理器
|
|
22
|
+
*/
|
|
23
|
+
export declare class CheckpointManager {
|
|
24
|
+
private taskRepo;
|
|
25
|
+
private checkpoints;
|
|
26
|
+
constructor(taskRepo?: PostgresTaskRepository);
|
|
27
|
+
/**
|
|
28
|
+
* 保存检查点
|
|
29
|
+
*
|
|
30
|
+
* @param taskId - 任务 ID
|
|
31
|
+
* @param stepName - 步骤名称
|
|
32
|
+
* @param state - 当前工作流状态
|
|
33
|
+
*/
|
|
34
|
+
saveCheckpoint(taskId: string, stepName: string, state: WorkflowState): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* 加载检查点
|
|
37
|
+
*
|
|
38
|
+
* @param taskId - 任务 ID
|
|
39
|
+
* @returns 检查点快照,如果不存在则返回 null
|
|
40
|
+
*/
|
|
41
|
+
loadCheckpoint(taskId: string): Promise<Checkpoint | null>;
|
|
42
|
+
/**
|
|
43
|
+
* 删除检查点
|
|
44
|
+
*
|
|
45
|
+
* @param taskId - 任务 ID
|
|
46
|
+
*/
|
|
47
|
+
removeCheckpoint(taskId: string): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* 清理所有检查点(内存)
|
|
50
|
+
*/
|
|
51
|
+
clearAll(): void;
|
|
52
|
+
/**
|
|
53
|
+
* 获取所有检查点信息
|
|
54
|
+
*
|
|
55
|
+
* @returns 所有检查点的列表
|
|
56
|
+
*/
|
|
57
|
+
getAllCheckpoints(): Checkpoint[];
|
|
58
|
+
/**
|
|
59
|
+
* 检查是否有检查点
|
|
60
|
+
*
|
|
61
|
+
* @param taskId - 任务 ID
|
|
62
|
+
* @returns 是否存在检查点
|
|
63
|
+
*/
|
|
64
|
+
hasCheckpoint(taskId: string): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* 从检查点恢复状态
|
|
67
|
+
*
|
|
68
|
+
* @param taskId - 任务 ID
|
|
69
|
+
* @param initialState - 初始状态(如果无检查点)
|
|
70
|
+
* @returns 恢复后的状态
|
|
71
|
+
*/
|
|
72
|
+
restoreState(taskId: string, initialState: WorkflowState): Promise<WorkflowState>;
|
|
73
|
+
/**
|
|
74
|
+
* 验证检查点完整性
|
|
75
|
+
*
|
|
76
|
+
* @param checkpoint - 检查点
|
|
77
|
+
* @returns 是否有效
|
|
78
|
+
*/
|
|
79
|
+
validateCheckpoint(checkpoint: Checkpoint): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* 获取检查点统计信息
|
|
82
|
+
*
|
|
83
|
+
* @returns 统计信息
|
|
84
|
+
*/
|
|
85
|
+
getStats(): {
|
|
86
|
+
totalCount: number;
|
|
87
|
+
checkpointsByStep: Record<string, number>;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* 检查点管理器单例
|
|
92
|
+
*/
|
|
93
|
+
export declare const checkpointManager: CheckpointManager;
|
|
94
|
+
//# sourceMappingURL=CheckpointManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckpointManager.d.ts","sourceRoot":"","sources":["../../../src/domain/workflow/CheckpointManager.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yDAAyD,CAAC;AAKjG;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IAC9B,SAAS,EAAE,IAAI,CAAC;CACjB;AAED;;GAEG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAyB;IACzC,OAAO,CAAC,WAAW,CAAsC;gBAE7C,QAAQ,CAAC,EAAE,sBAAsB;IAI7C;;;;;;OAMG;IACG,cAAc,CAClB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,aAAa,GACnB,OAAO,CAAC,IAAI,CAAC;IAwChB;;;;;OAKG;IACG,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IA+ChE;;;;OAIG;IACG,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IASrD;;OAEG;IACH,QAAQ,IAAI,IAAI;IAQhB;;;;OAIG;IACH,iBAAiB,IAAI,UAAU,EAAE;IAIjC;;;;;OAKG;IACH,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAItC;;;;;;OAMG;IACG,YAAY,CAChB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,aAAa,GAC1B,OAAO,CAAC,aAAa,CAAC;IA+BzB;;;;;OAKG;IACH,kBAAkB,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO;IAuBnD;;;;OAIG;IACH,QAAQ,IAAI;QACV,UAAU,EAAE,MAAM,CAAC;QACnB,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC3C;CAcF;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,mBAA0B,CAAC"}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CheckpointManager - 检查点管理器
|
|
3
|
+
*
|
|
4
|
+
* 负责工作流状态的保存和恢复:
|
|
5
|
+
* - 每个 Node 执行完成后保存 State 到数据库
|
|
6
|
+
* - 崩溃后从数据库恢复 State
|
|
7
|
+
* - 支持断点续传
|
|
8
|
+
*/
|
|
9
|
+
import { StateSnapshotManager } from './State.js';
|
|
10
|
+
import { PostgresTaskRepository } from '../../infrastructure/database/PostgresTaskRepository.js';
|
|
11
|
+
import { createLogger } from '../../infrastructure/logging/logger.js';
|
|
12
|
+
const logger = createLogger('CheckpointManager');
|
|
13
|
+
/**
|
|
14
|
+
* 检查点管理器
|
|
15
|
+
*/
|
|
16
|
+
export class CheckpointManager {
|
|
17
|
+
taskRepo;
|
|
18
|
+
checkpoints = new Map();
|
|
19
|
+
constructor(taskRepo) {
|
|
20
|
+
this.taskRepo = taskRepo || new PostgresTaskRepository();
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* 保存检查点
|
|
24
|
+
*
|
|
25
|
+
* @param taskId - 任务 ID
|
|
26
|
+
* @param stepName - 步骤名称
|
|
27
|
+
* @param state - 当前工作流状态
|
|
28
|
+
*/
|
|
29
|
+
async saveCheckpoint(taskId, stepName, state) {
|
|
30
|
+
try {
|
|
31
|
+
logger.debug('Saving checkpoint', {
|
|
32
|
+
taskId,
|
|
33
|
+
stepName,
|
|
34
|
+
});
|
|
35
|
+
// 创建检查点快照(只保存必要字段)
|
|
36
|
+
const snapshot = StateSnapshotManager.createCheckpoint(state);
|
|
37
|
+
// 保存到数据库(使用 State 快照)
|
|
38
|
+
await this.taskRepo.saveStateSnapshot(taskId, snapshot, state.version);
|
|
39
|
+
// 同时保存到内存(快速访问)
|
|
40
|
+
this.checkpoints.set(taskId, {
|
|
41
|
+
taskId,
|
|
42
|
+
stepName,
|
|
43
|
+
state: snapshot,
|
|
44
|
+
timestamp: new Date(),
|
|
45
|
+
});
|
|
46
|
+
logger.info('Checkpoint saved', {
|
|
47
|
+
taskId,
|
|
48
|
+
stepName,
|
|
49
|
+
keys: Object.keys(snapshot),
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
logger.error('Failed to save checkpoint', {
|
|
54
|
+
taskId,
|
|
55
|
+
stepName,
|
|
56
|
+
error: error instanceof Error ? error.message : String(error),
|
|
57
|
+
});
|
|
58
|
+
// 不抛出错误,避免影响主流程
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* 加载检查点
|
|
63
|
+
*
|
|
64
|
+
* @param taskId - 任务 ID
|
|
65
|
+
* @returns 检查点快照,如果不存在则返回 null
|
|
66
|
+
*/
|
|
67
|
+
async loadCheckpoint(taskId) {
|
|
68
|
+
try {
|
|
69
|
+
logger.debug('Loading checkpoint', { taskId });
|
|
70
|
+
// 先从内存查找
|
|
71
|
+
const memoryCheckpoint = this.checkpoints.get(taskId);
|
|
72
|
+
if (memoryCheckpoint) {
|
|
73
|
+
logger.info('Checkpoint loaded from memory', {
|
|
74
|
+
taskId,
|
|
75
|
+
stepName: memoryCheckpoint.stepName,
|
|
76
|
+
});
|
|
77
|
+
return memoryCheckpoint;
|
|
78
|
+
}
|
|
79
|
+
// 从数据库加载
|
|
80
|
+
const task = await this.taskRepo.findById(taskId);
|
|
81
|
+
if (!task || !task.stateSnapshot) {
|
|
82
|
+
logger.warn('No checkpoint found', { taskId });
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
// 创建检查点
|
|
86
|
+
const checkpoint = {
|
|
87
|
+
taskId,
|
|
88
|
+
stepName: task.currentStep || 'unknown',
|
|
89
|
+
state: task.stateSnapshot,
|
|
90
|
+
timestamp: task.updatedAt,
|
|
91
|
+
};
|
|
92
|
+
// 保存到内存
|
|
93
|
+
this.checkpoints.set(taskId, checkpoint);
|
|
94
|
+
logger.info('Checkpoint loaded from database', {
|
|
95
|
+
taskId,
|
|
96
|
+
stepName: checkpoint.stepName,
|
|
97
|
+
});
|
|
98
|
+
return checkpoint;
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
logger.error('Failed to load checkpoint', {
|
|
102
|
+
taskId,
|
|
103
|
+
error: error instanceof Error ? error.message : String(error),
|
|
104
|
+
});
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* 删除检查点
|
|
110
|
+
*
|
|
111
|
+
* @param taskId - 任务 ID
|
|
112
|
+
*/
|
|
113
|
+
async removeCheckpoint(taskId) {
|
|
114
|
+
logger.debug('Removing checkpoint', { taskId });
|
|
115
|
+
// 从内存删除
|
|
116
|
+
this.checkpoints.delete(taskId);
|
|
117
|
+
// 数据库中的 State 会在任务完成时自动清理
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* 清理所有检查点(内存)
|
|
121
|
+
*/
|
|
122
|
+
clearAll() {
|
|
123
|
+
logger.info('Clearing all checkpoints from memory', {
|
|
124
|
+
count: this.checkpoints.size,
|
|
125
|
+
});
|
|
126
|
+
this.checkpoints.clear();
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* 获取所有检查点信息
|
|
130
|
+
*
|
|
131
|
+
* @returns 所有检查点的列表
|
|
132
|
+
*/
|
|
133
|
+
getAllCheckpoints() {
|
|
134
|
+
return Array.from(this.checkpoints.values());
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* 检查是否有检查点
|
|
138
|
+
*
|
|
139
|
+
* @param taskId - 任务 ID
|
|
140
|
+
* @returns 是否存在检查点
|
|
141
|
+
*/
|
|
142
|
+
hasCheckpoint(taskId) {
|
|
143
|
+
return this.checkpoints.has(taskId);
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* 从检查点恢复状态
|
|
147
|
+
*
|
|
148
|
+
* @param taskId - 任务 ID
|
|
149
|
+
* @param initialState - 初始状态(如果无检查点)
|
|
150
|
+
* @returns 恢复后的状态
|
|
151
|
+
*/
|
|
152
|
+
async restoreState(taskId, initialState) {
|
|
153
|
+
logger.debug('Restoring state from checkpoint', { taskId });
|
|
154
|
+
const checkpoint = await this.loadCheckpoint(taskId);
|
|
155
|
+
if (!checkpoint) {
|
|
156
|
+
logger.info('No checkpoint found, using initial state', { taskId });
|
|
157
|
+
return initialState;
|
|
158
|
+
}
|
|
159
|
+
// 合并初始状态和检查点状态
|
|
160
|
+
const restoredState = {
|
|
161
|
+
...initialState,
|
|
162
|
+
...checkpoint.state,
|
|
163
|
+
// 确保关键字段不被覆盖
|
|
164
|
+
taskId: initialState.taskId,
|
|
165
|
+
mode: initialState.mode,
|
|
166
|
+
topic: initialState.topic,
|
|
167
|
+
requirements: initialState.requirements,
|
|
168
|
+
hardConstraints: initialState.hardConstraints,
|
|
169
|
+
};
|
|
170
|
+
logger.info('State restored from checkpoint', {
|
|
171
|
+
taskId,
|
|
172
|
+
stepName: checkpoint.stepName,
|
|
173
|
+
currentStep: restoredState.currentStep,
|
|
174
|
+
});
|
|
175
|
+
return restoredState;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* 验证检查点完整性
|
|
179
|
+
*
|
|
180
|
+
* @param checkpoint - 检查点
|
|
181
|
+
* @returns 是否有效
|
|
182
|
+
*/
|
|
183
|
+
validateCheckpoint(checkpoint) {
|
|
184
|
+
if (!checkpoint.taskId) {
|
|
185
|
+
logger.warn('Invalid checkpoint: missing taskId');
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
if (!checkpoint.stepName) {
|
|
189
|
+
logger.warn('Invalid checkpoint: missing stepName', {
|
|
190
|
+
taskId: checkpoint.taskId,
|
|
191
|
+
});
|
|
192
|
+
return false;
|
|
193
|
+
}
|
|
194
|
+
if (!checkpoint.state || Object.keys(checkpoint.state).length === 0) {
|
|
195
|
+
logger.warn('Invalid checkpoint: empty state', {
|
|
196
|
+
taskId: checkpoint.taskId,
|
|
197
|
+
});
|
|
198
|
+
return false;
|
|
199
|
+
}
|
|
200
|
+
return true;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* 获取检查点统计信息
|
|
204
|
+
*
|
|
205
|
+
* @returns 统计信息
|
|
206
|
+
*/
|
|
207
|
+
getStats() {
|
|
208
|
+
const checkpoints = this.getAllCheckpoints();
|
|
209
|
+
const checkpointsByStep = {};
|
|
210
|
+
for (const checkpoint of checkpoints) {
|
|
211
|
+
checkpointsByStep[checkpoint.stepName] =
|
|
212
|
+
(checkpointsByStep[checkpoint.stepName] || 0) + 1;
|
|
213
|
+
}
|
|
214
|
+
return {
|
|
215
|
+
totalCount: checkpoints.length,
|
|
216
|
+
checkpointsByStep,
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* 检查点管理器单例
|
|
222
|
+
*/
|
|
223
|
+
export const checkpointManager = new CheckpointManager();
|
|
224
|
+
//# sourceMappingURL=CheckpointManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckpointManager.js","sourceRoot":"","sources":["../../../src/domain/workflow/CheckpointManager.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yDAAyD,CAAC;AACjG,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE,MAAM,MAAM,GAAG,YAAY,CAAC,mBAAmB,CAAC,CAAC;AAYjD;;GAEG;AACH,MAAM,OAAO,iBAAiB;IACpB,QAAQ,CAAyB;IACjC,WAAW,GAA4B,IAAI,GAAG,EAAE,CAAC;IAEzD,YAAY,QAAiC;QAC3C,IAAI,CAAC,QAAQ,GAAG,QAAQ,IAAI,IAAI,sBAAsB,EAAE,CAAC;IAC3D,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,cAAc,CAClB,MAAc,EACd,QAAgB,EAChB,KAAoB;QAEpB,IAAI,CAAC;YACH,MAAM,CAAC,KAAK,CAAC,mBAAmB,EAAE;gBAChC,MAAM;gBACN,QAAQ;aACT,CAAC,CAAC;YAEH,mBAAmB;YACnB,MAAM,QAAQ,GAAG,oBAAoB,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;YAE9D,sBAAsB;YACtB,MAAM,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CACnC,MAAM,EACN,QAAQ,EACR,KAAK,CAAC,OAAO,CACd,CAAC;YAEF,gBAAgB;YAChB,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,EAAE;gBAC3B,MAAM;gBACN,QAA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CAAC,MAAM;aAC1B,CAAC,CAAC;YACH,OAAO,KAAK,CAAC;QACf,CAAC;QAED,IAAI,CAAC,UAAU,CAAC,KAAK,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACpE,MAAM,CAAC,IAAI,CAAC,iCAAiC,EAAE;gBAC7C,MAAM,EAAE,UAAU,CAAC,MAAM;aAC1B,CAAC,CAAC;YACH,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,QAAQ;QAIN,MAAM,WAAW,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAC7C,MAAM,iBAAiB,GAA2B,EAAE,CAAC;QAErD,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;YACrC,iBAAiB,CAAC,UAAU,CAAC,QAAQ,CAAC;gBACpC,CAAC,iBAAiB,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACtD,CAAC;QAED,OAAO;YACL,UAAU,EAAE,WAAW,CAAC,MAAM;YAC9B,iBAAiB;SAClB,CAAC;IACJ,CAAC;CACF;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ContentCreatorGraph - 内容创作者工作流图
|
|
3
|
+
*
|
|
4
|
+
* 基于 LangGraph 构建的完整工作流,包含:
|
|
5
|
+
* - 搜索 → 整理 → 写作 → 文本质检 → 生成配图 → 配图质检
|
|
6
|
+
* - 支持质检失败重试
|
|
7
|
+
* - 支持断点续传
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* 创建内容创作者工作流图
|
|
11
|
+
*/
|
|
12
|
+
export declare function createContentCreatorGraph(): any;
|
|
13
|
+
/**
|
|
14
|
+
* 创建内容创作者工作流图(简化版,不带检查点)
|
|
15
|
+
*/
|
|
16
|
+
export declare function createSimpleContentCreatorGraph(): any;
|
|
17
|
+
//# sourceMappingURL=ContentCreatorGraph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentCreatorGraph.d.ts","sourceRoot":"","sources":["../../../src/domain/workflow/ContentCreatorGraph.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAiIH;;GAEG;AACH,wBAAgB,yBAAyB,IAAI,GAAG,CAuK/C;AAED;;GAEG;AACH,wBAAgB,+BAA+B,IAAI,GAAG,CAsIrD"}
|