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:
@@ -0,0 +1,41 @@
|
||||
package activity
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/rockliang/poimen/workflows/pkg/types"
|
||||
"go.temporal.io/sdk/activity"
|
||||
)
|
||||
|
||||
type ImplementerInput struct {
|
||||
Config types.OrchestratorConfig
|
||||
TaskID string
|
||||
WorktreePath string
|
||||
Lessons string
|
||||
}
|
||||
|
||||
type ImplementerOutput struct {
|
||||
Success bool
|
||||
Changes string
|
||||
}
|
||||
|
||||
func ImplementerActivity(ctx context.Context, in ImplementerInput) (ImplementerOutput, error) {
|
||||
activity.RecordHeartbeat(ctx, "starting implementer for "+in.TaskID)
|
||||
|
||||
vars := map[string]any{
|
||||
"SystemPrompt": in.Config.SystemPrompt,
|
||||
"Task": in.TaskID,
|
||||
"WorktreePath": in.WorktreePath,
|
||||
}
|
||||
if in.Lessons != "" {
|
||||
vars["Lessons"] = in.Lessons
|
||||
}
|
||||
|
||||
response, err := CallRoleLLM(ctx, in.Config, "implementer", vars)
|
||||
if err != nil {
|
||||
return ImplementerOutput{}, err
|
||||
}
|
||||
|
||||
activity.RecordHeartbeat(ctx, "implementer completed for "+in.TaskID)
|
||||
return ImplementerOutput{Success: true, Changes: response}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user