| 1 | package coordinator |
| 2 | |
| 3 | import ( |
| 4 | "amadan.net/oficina/equipo/internal/runnerproto" |
| 5 | "amadan.net/oficina/equipo/internal/taskplan" |
| 6 | "context" |
| 7 | ) |
| 8 | |
| 9 | type CoordinatorToolCall = runnerproto.CoordinatorToolCall |
| 10 | type CoordinatorToolResult = runnerproto.CoordinatorToolResult |
| 11 | type ClarificationQuestion = runnerproto.ClarificationQuestion |
| 12 | type QuestionOption = runnerproto.QuestionOption |
| 13 | type ToolClient interface { |
| 14 | Call(context.Context, CoordinatorToolCall) (CoordinatorToolResult, error) |
| 15 | } |
| 16 | |
| 17 | type ToolFunc func(context.Context, CoordinatorToolCall) (CoordinatorToolResult, error) |
| 18 | |
| 19 | func (f ToolFunc) Call(ctx context.Context, c CoordinatorToolCall) (CoordinatorToolResult, error) { |
| 20 | return f(ctx, c) |
| 21 | } |
| 22 | |
| 23 | type ReadProject struct { |
| 24 | ProjectID int64 `json:"project_id"` |
| 25 | } |
| 26 | type ReadTask struct { |
| 27 | TaskID string `json:"task_id"` |
| 28 | } |
| 29 | type PlanStep struct { |
| 30 | Key string `json:"key"` |
| 31 | Specialist string `json:"specialist,omitempty"` |
| 32 | Action string `json:"action"` |
| 33 | Instructions string `json:"instructions,omitempty"` |
| 34 | DependsOn []string `json:"depends_on,omitempty"` |
| 35 | } |
| 36 | type Plan struct { |
| 37 | PlaybookID string `json:"playbook_id,omitempty"` |
| 38 | PlaybookRevision int64 `json:"playbook_revision,omitempty"` |
| 39 | Kind taskplan.Kind `json:"kind"` |
| 40 | ProjectID int64 `json:"project_id"` |
| 41 | Steps []PlanStep `json:"steps"` |
| 42 | } |
| 43 | |
| 44 | func (p Plan) TaskPlan() taskplan.Plan { |
| 45 | out := taskplan.Plan{Kind: p.Kind, ProjectID: p.ProjectID, PlaybookID: p.PlaybookID, PlaybookRevision: p.PlaybookRevision} |
| 46 | for _, s := range p.Steps { |
| 47 | out.Steps = append(out.Steps, taskplan.Step{Key: s.Key, Specialist: s.Specialist, Action: s.Action, Instructions: s.Instructions, DependsOn: s.DependsOn}) |
| 48 | } |
| 49 | return out |
| 50 | } |
| 51 | |
| 52 | type ProposeProject struct { |
| 53 | Repository string `json:"repository"` |
| 54 | Why string `json:"why"` |
| 55 | } |
| 56 | |
| 57 | type ProposePlan struct { |
| 58 | MessageID string `json:"message_id"` |
| 59 | Plan Plan `json:"plan"` |
| 60 | } |
| 61 | type AskPerson struct { |
| 62 | MessageID string `json:"message_id"` |
| 63 | Question string `json:"question"` |
| 64 | Options []QuestionOption `json:"options"` |
| 65 | } |
| 66 | type RouteToTask struct { |
| 67 | MessageID string `json:"message_id"` |
| 68 | TaskID string `json:"task_id"` |
| 69 | } |
| 70 | type PostMessage struct { |
| 71 | Body string `json:"body"` |
| 72 | SourceRefs []taskplan.SourceRef `json:"source_refs"` |
| 73 | } |
| 74 | type SuggestPreference struct { |
| 75 | SourceMessageID string `json:"source_message_id"` |
| 76 | Text string `json:"text"` |
| 77 | } |
| 78 | type Draft struct { |
| 79 | Name string `json:"name"` |
| 80 | Instructions string `json:"instructions"` |
| 81 | } |
| 82 | type SuggestDraft struct { |
| 83 | SourceMessageIDs []string `json:"source_message_ids"` |
| 84 | Draft Draft `json:"draft"` |
| 85 | } |
| 86 | |
| 87 | // EquipoStatus accepts no scope supplied by the model. |
| 88 | type EquipoStatus struct{} |
| 89 | |