mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-24 11:47:16 +00:00
refactor(monorepo): decouple and split background workflow workers into packages
Splits monolithic workflow workers into four decoupled workspaces under the Bun workspaces monorepo: - @shumai/workflow-core containing the core execution engine and utilities. - @shumai/agent containing agent-specific logic, workflows, and activities. - @shumai/transcode containing transcoding workflows, transcoder, and transcode activities. - @shumai/worker-db containing database activities. Introduces a dynamic workflow and activity registration pattern on LocalExecutor to eliminate circular dependencies. Updates worker bootstrapping and test suites to cleanly leverage generic workspace modules.
This commit is contained in:
+9
-1
@@ -24,7 +24,10 @@ import uploadRoute from '@/api/upload'
|
||||
import versionStackRoute from '@/api/versionStack'
|
||||
import { metadataService } from '@shumai/core/src/metadata/metadata'
|
||||
import { assetService } from '@shumai/core/src/asset/asset'
|
||||
import { workflowService } from '@/workflow/workflow'
|
||||
import { workflowService } from '@shumai/workflow-core'
|
||||
import { initAgentWorkflows } from '@shumai/agent'
|
||||
import { initTranscodeWorkflows } from '@shumai/transcode'
|
||||
import { initDbWorkflows } from '@shumai/worker-db'
|
||||
|
||||
type User = Prisma.UserGetPayload<Record<string, never>>
|
||||
|
||||
@@ -62,6 +65,11 @@ const apiAppRoute = app.route('/api', apiRoute)
|
||||
export type AppType = typeof apiAppRoute
|
||||
|
||||
export async function run() {
|
||||
// Initialize workflows and activities for local executor mode
|
||||
initAgentWorkflows()
|
||||
initTranscodeWorkflows()
|
||||
initDbWorkflows()
|
||||
|
||||
// Start services
|
||||
await metadataService.syncSystemFields().catch(console.error)
|
||||
assetService.startCleanupJob()
|
||||
|
||||
+10
-2
@@ -1,7 +1,15 @@
|
||||
import { workflowService } from '@/workflow/workflow'
|
||||
import { TaskQueueAgent, TaskQueueTranscode } from '@/workflow/workflow-utils'
|
||||
import { workflowService } from '@shumai/workflow-core'
|
||||
import { TaskQueueAgent, TaskQueueTranscode } from '@shumai/workflow-core'
|
||||
import { initAgentWorkflows } from '@shumai/agent'
|
||||
import { initTranscodeWorkflows } from '@shumai/transcode'
|
||||
import { initDbWorkflows } from '@shumai/worker-db'
|
||||
|
||||
export async function run() {
|
||||
// Initialize workflows and activities
|
||||
initAgentWorkflows()
|
||||
initTranscodeWorkflows()
|
||||
initDbWorkflows()
|
||||
|
||||
const domain = process.argv[3]
|
||||
|
||||
if (!domain) {
|
||||
|
||||
Reference in New Issue
Block a user