refactor: rename action→activity, statemachine→workflow, remove HTTP API layer
- action/ → activity/ (Temporal activities) - statemachine/ → workflow/ (Temporal workflows) - Removed internal/api/ and cmd/server/ (api-gw handles HTTP, Temporal is the API) - Created pkg/types/types.go as single source of truth for all shared types - Extracted CallRoleLLM helper (DRY: implementer/planner/judge shared pattern) - Fixed circular import: workflow_graph_query uses string activity names - Fixed logger.logf → logger.Info/Warn (method didn't exist) - Fixed routing types: added Branches, Activity, BackoffSeconds, TaskActivity - Fixed db.Canvas.Name, db.Client→DB, GetWorkflow→FetchWorkflow - Removed unused imports - All tests pass, build clean, vet clean
This commit is contained in:
+15
-15
@@ -11,12 +11,12 @@ import (
|
||||
"time"
|
||||
|
||||
"go.temporal.io/sdk/client"
|
||||
"github.com/rockliang/poimen/workflows/action/llm"
|
||||
"github.com/rockliang/poimen/workflows/activity/llm"
|
||||
"github.com/rockliang/poimen/workflows/internal/config"
|
||||
"github.com/rockliang/poimen/workflows/internal/health"
|
||||
"github.com/rockliang/poimen/workflows/internal/logging"
|
||||
"github.com/rockliang/poimen/workflows/internal/routing"
|
||||
"github.com/rockliang/poimen/workflows/statemachine"
|
||||
"github.com/rockliang/poimen/workflows/workflow"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -89,20 +89,20 @@ func main() {
|
||||
|
||||
|
||||
// Build OrchestratorInput
|
||||
input := statemachine.OrchestratorInput{
|
||||
input := workflow.OrchestratorInput{
|
||||
TargetRepoPath: *repoPath,
|
||||
RemoteURL: *remoteURL,
|
||||
Milestone: *milestone,
|
||||
DryRun: *dryRun,
|
||||
MaxCyclesBeforeCAN: 100,
|
||||
PiProvider: *piProvider,
|
||||
Config: statemachine.OrchestratorConfig{
|
||||
Config: workflow.OrchestratorConfig{
|
||||
SystemPrompt: "You are an expert software developer orchestrating multi-agent work.",
|
||||
Skills: []statemachine.SkillRef{},
|
||||
RolePrompts: map[string]statemachine.PromptSpec{
|
||||
Skills: []workflow.SkillRef{},
|
||||
RolePrompts: map[string]workflow.PromptSpec{
|
||||
"planner": {
|
||||
TemplateRef: "planner/default.tmpl",
|
||||
Model: statemachine.ModelSpec{
|
||||
Model: workflow.ModelSpec{
|
||||
ModelID: *plannerModel,
|
||||
Thinking: "adaptive",
|
||||
Effort: "high",
|
||||
@@ -110,7 +110,7 @@ func main() {
|
||||
},
|
||||
"judge": {
|
||||
TemplateRef: "judge/default.tmpl",
|
||||
Model: statemachine.ModelSpec{
|
||||
Model: workflow.ModelSpec{
|
||||
ModelID: *judgeModel,
|
||||
Thinking: "adaptive",
|
||||
Effort: "high",
|
||||
@@ -118,12 +118,12 @@ func main() {
|
||||
},
|
||||
"implementer": {
|
||||
TemplateRef: "implementer/default.tmpl",
|
||||
Model: statemachine.ModelSpec{
|
||||
Model: workflow.ModelSpec{
|
||||
ModelID: *implementerModel,
|
||||
},
|
||||
},
|
||||
},
|
||||
Tuning: statemachine.NewActivityTuning(),
|
||||
Tuning: workflow.NewActivityTuning(),
|
||||
},
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ func main() {
|
||||
run, err := c.ExecuteWorkflow(context.Background(), client.StartWorkflowOptions{
|
||||
ID: workflowID,
|
||||
TaskQueue: "poimen-taskqueue",
|
||||
}, statemachine.OrchestratorWorkflow, input)
|
||||
}, workflow.OrchestratorWorkflow, input)
|
||||
if err != nil {
|
||||
logging.Fatal("failed to start workflow", logging.Err(err))
|
||||
}
|
||||
@@ -164,7 +164,7 @@ func main() {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute)
|
||||
defer cancel()
|
||||
|
||||
var result statemachine.OrchestratorOutput
|
||||
var result workflow.OrchestratorOutput
|
||||
if err := run.Get(ctx, &result); err != nil {
|
||||
fmt.Printf("\nWorkflow initiated (execution in progress).\n")
|
||||
fmt.Printf("Check the Web UI for real-time status updates.\n")
|
||||
@@ -267,12 +267,12 @@ func runRoutingWorkflow(c client.Client, routeMsg, specFile string, isCron, dryR
|
||||
}
|
||||
|
||||
workflowID := "routing-" + spec.Name + "-" + time.Now().Format("20060102-150405")
|
||||
input := statemachine.RoutingWorkflowInput{Spec: spec}
|
||||
input := workflow.RoutingWorkflowInput{Spec: spec}
|
||||
|
||||
run, err := c.ExecuteWorkflow(ctx, client.StartWorkflowOptions{
|
||||
ID: workflowID,
|
||||
TaskQueue: "poimen-taskqueue",
|
||||
}, statemachine.RoutingWorkflow, input)
|
||||
}, workflow.RoutingWorkflow, input)
|
||||
if err != nil {
|
||||
logging.Fatal("failed to start routing workflow", logging.Err(err))
|
||||
}
|
||||
@@ -285,7 +285,7 @@ func runRoutingWorkflow(c client.Client, routeMsg, specFile string, isCron, dryR
|
||||
waitCtx, cancel := context.WithTimeout(ctx, 30*time.Second)
|
||||
defer cancel()
|
||||
|
||||
var result statemachine.RoutingWorkflowOutput
|
||||
var result workflow.RoutingWorkflowOutput
|
||||
if err := run.Get(waitCtx, &result); err != nil {
|
||||
fmt.Printf("\nWorkflow running (check Temporal UI for status)\n")
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user