42 lines
944 B
Go
42 lines
944 B
Go
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
|
||
|
|
}
|