initial impl
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from agentci.domain.models import Job, JobKind
|
||||
from agentci.workflows.common import Dependencies
|
||||
from agentci.workflows.implement import ImplementWorkflow
|
||||
from agentci.workflows.plan import PlanWorkflow
|
||||
from agentci.workflows.pull_request import PullRequestWorkflow
|
||||
|
||||
|
||||
class Dispatcher:
|
||||
def __init__(self, dependencies: Dependencies) -> None:
|
||||
plan = PlanWorkflow(dependencies)
|
||||
pull_request = PullRequestWorkflow(dependencies)
|
||||
self.handlers = {
|
||||
JobKind.PLAN: plan.plan,
|
||||
JobKind.DISCUSS: plan.discuss,
|
||||
JobKind.ITERATE_PLAN: plan.iterate,
|
||||
JobKind.IMPLEMENT: ImplementWorkflow(dependencies).run,
|
||||
JobKind.ITERATE_IMPLEMENT: pull_request.iterate,
|
||||
JobKind.FIX: pull_request.fix,
|
||||
}
|
||||
|
||||
async def dispatch(self, job: Job) -> None:
|
||||
await self.handlers[job.kind](job)
|
||||
|
||||
Reference in New Issue
Block a user